diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 37b5b12..075190b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -27,6 +27,6 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # tag=v8.0.0 with: - version: v1.61.0 + version: v2.1.0 working-directory: ${{matrix.working-directory}} args: --timeout=5m diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml deleted file mode 100644 index f8cf1a8..0000000 --- a/.github/workflows/verify.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: verify - -on: - pull_request_target: - types: [opened, edited, synchronize, reopened] - -permissions: - checks: write # Allow access to checks to write check runs. - -jobs: - verify: - runs-on: ubuntu-latest - name: verify PR contents - steps: - - name: Verifier action - id: verifier - uses: kubernetes-sigs/kubebuilder-release-tools@v0.4.3 - # Don't run this step on PRs created by the cherry-pick bot, - # as the PR description is too short, but otherwise the PRs are fine. - if: ${{ github.event.pull_request.head.repo.owner.login != 'k8s-infra-cherrypick-robot' }} - with: - github_token: ${{ secrets.GH_TOKEN }} diff --git a/.gitignore b/.gitignore index c2daa54..0c1dbcb 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,7 @@ _artifacts ` # Temp files -tmp/ \ No newline at end of file +tmp/ + +# Release Files +out/ \ No newline at end of file diff --git a/.golangci.bck.yaml b/.golangci.bck.yaml deleted file mode 100644 index 274dc3b..0000000 --- a/.golangci.bck.yaml +++ /dev/null @@ -1,138 +0,0 @@ -# version: "2" # Temporarily commented out to check compatibility with v1.64.8 -run: - go: "1.24" - allow-parallel-runners: true -linters: - default: none - enable: - - asasalint - - asciicheck - - bidichk - - bodyclose - - containedctx - - contextcheck - - copyloopvar - - dogsled - - durationcheck - - errcheck - - errchkjson - - errname - - errorlint - - exhaustive - - forcetypeassert - - ginkgolinter - - goconst - - gocritic - - gocyclo - - godot - - goheader - - goprintffuncname - - govet - - importas - - ineffassign - - makezero - - misspell - - nakedret - - nilerr - - nlreturn - - noctx - - nolintlint - - prealloc - - predeclared - - promlinter - - reassign - - rowserrcheck - - sqlclosecheck - - staticcheck - - testableexamples - - thelper - - tparallel - - unconvert - - unparam - - unused - - usestdlibvars - - wastedassign - - whitespace - settings: - goheader: - values: - regexp: - license-year: (202[0-9]|20[3-9][0-9]) - template: |- - Copyright {{license-year}} The Kubernetes 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. - importas: - alias: - - pkg: k8s.io/api/core/v1 - alias: corev1 - - pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 - alias: apiextensionsv1 - - pkg: k8s.io/apimachinery/pkg/apis/meta/v1 - alias: metav1 - - pkg: k8s.io/apimachinery/pkg/api/errors - alias: apierrors - - pkg: k8s.io/apimachinery/pkg/util/errors - alias: kerrors - - pkg: k8s.io/apimachinery/pkg/util/runtime - alias: utilruntime - - pkg: sigs.k8s.io/controller-runtime - alias: ctrl - - pkg: sigs.k8s.io/cluster-api/api/v1beta1 - alias: clusterv1 - - pkg: sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3 - alias: clusterctlv1 - - pkg: sigs.k8s.io/cluster-api/cmd/clusterctl/client/config - alias: configclient - - pkg: github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s - alias: addonsv1alpha1 - no-unaliased: true - nlreturn: - block-size: 2 - staticcheck: - checks: - - all - - -ST1000 - - -ST1003 - - -ST1016 - dot-import-whitelist: - - github.com/onsi/gomega - exclusions: - generated: lax - rules: - - linters: - - gosec - path: _test\.go - - linters: - - goheader - path: hack/boilerplate - - path: (.+)\.go$ - text: 'missing cases in switch of type v1.PlatformType: (\.*)' - paths: - - zz_generated.*\.go$ - - third_party$ - - builtin$ - - examples$ -formatters: - enable: - - gci - - gofmt - - gofumpt - - goimports - exclusions: - generated: lax - paths: - - zz_generated.*\.go$ - - third_party$ - - builtin$ - - examples$ diff --git a/Dockerfile b/Dockerfile index 22eb5fc..af29c65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ ARG ARCH # It's an invalid finding since the image is explicitly set in the Makefile. # https://github.com/hadolint/hadolint/wiki/DL3006 # hadolint ignore=DL3006 -FROM ${builder_image} as builder +FROM ${builder_image} AS builder WORKDIR /workspace # Run this with docker build --build-arg goproxy=$(go env GOPROXY) to override the goproxy @@ -71,34 +71,31 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ # Production image FROM ${deployment_base_image}:${deployment_base_image_tag} +# Set shell with pipefail option for better error handling +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + # Install Node.js and cdk8s-cli directly +# hadolint ignore=DL3015 RUN apt-get update && \ - apt-get install -y ca-certificates curl wget && \ + apt-get install -y --no-install-recommends ca-certificates=20240203~22.04.1 curl=7.81.0-1ubuntu1.20 && \ curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ - apt-get install -y nodejs && \ - npm install -g cdk8s-cli && \ - wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz && \ - tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz && \ - rm go1.21.5.linux-amd64.tar.gz && \ + apt-get install -y nodejs=18.19.1-1nodesource1 && \ + npm install -g cdk8s-cli@2.200.97 && \ + curl -fsSL -o go1.24.4.linux-amd64.tar.gz https://go.dev/dl/go1.24.4.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go1.24.4.linux-amd64.tar.gz && \ + rm go1.24.4.linux-amd64.tar.gz && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - # Set Go environment variables +# Set Go environment variables ENV PATH=$PATH:/usr/local/go/bin ENV GOROOT=/usr/local/go -RUN cdk8s --version && go version - WORKDIR / COPY --from=builder /workspace/manager . # Create non-root user RUN useradd --uid 65532 --create-home --shell /bin/bash nonroot - -# Ensure the non-root user can access Go by setting up their environment -RUN echo 'export PATH=$PATH:/usr/local/go/bin' >> /home/nonroot/.bashrc && \ - echo 'export GOROOT=/usr/local/go' >> /home/nonroot/.bashrc && \ - echo 'export PATH=$PATH:/usr/local/go/bin' >> /home/nonroot/.profile # Switch back to non-root user (this line should already exist) # USER root # This was part of the removed direct install, ensure it's not re-added here unless needed for COPY permissions diff --git a/Makefile b/Makefile index 07ba8ca..4d0689c 100644 --- a/Makefile +++ b/Makefile @@ -45,8 +45,6 @@ export GO111MODULE=on # Base docker images DOCKERFILE_CONTAINER_IMAGE ?= docker.io/docker/dockerfile:1.4 -# DEPLOYMENT_BASE_IMAGE ?= gcr.io/distroless/static -# DEPLOYMENT_BASE_IMAGE_TAG ?= nonroot-${ARCH} DEPLOYMENT_BASE_IMAGE ?= ubuntu DEPLOYMENT_BASE_IMAGE_TAG ?= 22.04 BUILD_CONTAINER_ADDITIONAL_ARGS ?= @@ -220,7 +218,7 @@ endif PROD_REGISTRY ?= ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s -STAGING_REGISTRY ?= ghcr.io/patricklaabs/k8s-staging-cluster-api-cdk8s +STAGING_REGISTRY ?= ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s STAGING_BUCKET ?= artifacts.k8s-staging-cluster-api-cdk8s.appspot.com # core @@ -232,7 +230,7 @@ CAPI_KIND_CLUSTER_NAME ?= capi-test # It is set by Prow GIT_TAG, a git-based tag of the form vYYYYMMDD-hash, e.g., v20210120-v0.3.10-308-gc61521971 -TAG ?= v0.2.4-alpha +TAG ?= v0.2.11-preview ARCH ?= $(shell go env GOARCH) ALL_ARCH = amd64 arm arm64 @@ -594,7 +592,7 @@ release-staging: ## Build and push container images to the staging bucket REGISTRY=$(STAGING_REGISTRY) $(MAKE) docker-build-all docker-push-all release-alias-tag .PHONY: release-staging-nightly -release-staging-nightly: ## Tag and push container images to the staging bucket. Example image tag: cluster-api-helm-controller:nightly_main_20210121 +release-staging-nightly: ## Tag and push container images to the staging bucket. Example image tag: cluster-api-cdk8s-controller:nightly_main_20210121 $(eval NEW_RELEASE_ALIAS_TAG := nightly_$(RELEASE_ALIAS_TAG)_$(shell date +'%Y%m%d')) echo $(NEW_RELEASE_ALIAS_TAG) $(MAKE) release-alias-tag TAG=$(RELEASE_ALIAS_TAG) RELEASE_ALIAS_TAG=$(NEW_RELEASE_ALIAS_TAG) diff --git a/api/v1alpha1/cdk8sappproxy_types.go b/api/v1alpha1/cdk8sappproxy_types.go index 269c4b3..020a03c 100644 --- a/api/v1alpha1/cdk8sappproxy_types.go +++ b/api/v1alpha1/cdk8sappproxy_types.go @@ -41,7 +41,7 @@ type GitRepositorySpec struct { // containing authentication credentials for the Git repository. // The secret must contain 'username' and 'password' fields. // +kubebuilder:validation:Optional - AuthSecretRef *corev1.LocalObjectReference `json:"authSecretRef,omitempty"` // New field + AuthSecretRef *corev1.LocalObjectReference `json:"authSecretRef,omitempty"` } // Cdk8sAppProxySpec defines the desired state of Cdk8sAppProxy. diff --git a/api/v1alpha1/cdk8sappproxy_webhook_test.go b/api/v1alpha1/cdk8sappproxy_webhook_test.go index d3f75ab..0707950 100644 --- a/api/v1alpha1/cdk8sappproxy_webhook_test.go +++ b/api/v1alpha1/cdk8sappproxy_webhook_test.go @@ -1,7 +1,6 @@ package v1alpha1 import ( - "context" "testing" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" @@ -90,12 +89,7 @@ func TestCdk8sAppProxy_Default(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - ctx := context.Background() - err := tt.proxy.Default(ctx, tt.proxy) - if err != nil { - t.Errorf("Default() error = %v", err) - return - } + tt.proxy.Default() if tt.proxy.Spec.GitRepository != nil && tt.expected.Spec.GitRepository != nil { if tt.proxy.Spec.GitRepository.Reference != tt.expected.Spec.GitRepository.Reference { @@ -177,21 +171,19 @@ func TestCdk8sAppProxy_ValidateCreate(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - ctx := context.Background() - warnings, err := tt.proxy.ValidateCreate(ctx, tt.proxy) + warnings, err := tt.proxy.ValidateCreate() if tt.wantError { if err == nil { t.Errorf("ValidateCreate() expected error, got nil") + return } if tt.errorMsg != "" && err.Error() != "validation failed: ["+tt.errorMsg+"]" { t.Errorf("ValidateCreate() error = %v, want error containing %v", err.Error(), tt.errorMsg) } - } else { - if err != nil { - t.Errorf("ValidateCreate() unexpected error = %v", err) - } + } else if err != nil { + t.Errorf("ValidateCreate() unexpected error = %v", err) } // Warnings should always be nil in our implementation @@ -248,8 +240,7 @@ func TestCdk8sAppProxy_ValidateUpdate(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - ctx := context.Background() - warnings, err := tt.newProxy.ValidateUpdate(ctx, tt.oldProxy, tt.newProxy) + warnings, err := tt.newProxy.ValidateUpdate(tt.oldProxy) if tt.wantError { if err == nil { @@ -278,8 +269,7 @@ func TestCdk8sAppProxy_ValidateDelete(t *testing.T) { }, } - ctx := context.Background() - warnings, err := proxy.ValidateDelete(ctx, proxy) + warnings, err := proxy.ValidateDelete() if err != nil { t.Errorf("ValidateDelete() unexpected error = %v", err) @@ -335,15 +325,17 @@ func TestCdk8sAppProxy_validateCdk8sAppProxy(t *testing.T) { if (err != nil) != tt.wantError { t.Errorf("validateCdk8sAppProxy() error = %v, wantError %v", err, tt.wantError) + return } // Compare warnings properly - if tt.wantWarnings == nil && warnings != nil { + switch { + case tt.wantWarnings == nil && warnings != nil: t.Errorf("validateCdk8sAppProxy() warnings = %v, want nil", warnings) - } else if tt.wantWarnings != nil && warnings == nil { + case tt.wantWarnings != nil && warnings == nil: t.Errorf("validateCdk8sAppProxy() warnings = nil, want %v", tt.wantWarnings) - } else if tt.wantWarnings != nil && warnings != nil { + case tt.wantWarnings != nil && warnings != nil: if len(warnings) != len(tt.wantWarnings) { t.Errorf("validateCdk8sAppProxy() warnings length = %d, want %d", len(warnings), len(tt.wantWarnings)) } else { diff --git a/api/v1alpha1/cdk8sappproxy_webook.go b/api/v1alpha1/cdk8sappproxy_webook.go index bd1bcc5..0ea6254 100644 --- a/api/v1alpha1/cdk8sappproxy_webook.go +++ b/api/v1alpha1/cdk8sappproxy_webook.go @@ -3,7 +3,7 @@ package v1alpha1 import ( "fmt" - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" @@ -13,29 +13,29 @@ import ( // log is for logging in this package. var cdk8sappproxylog = logf.Log.WithName("cdk8sappproxy-resource") -func (r *Cdk8sAppProxy) SetupWebhookWithManager(mgr ctrl.Manager) error { +func (c *Cdk8sAppProxy) SetupWebhookWithManager(mgr ctrl.Manager) error { return ctrl.NewWebhookManagedBy(mgr). - For(r). + For(c). Complete() } // +kubebuilder:webhook:path=/mutate-addons-cluster-x-k8s-io-v1alpha1-cdk8sappproxy,mutating=true,failurePolicy=fail,sideEffects=None,groups=addons.cluster.x-k8s.io,resources=cdk8sappproxies,verbs=create;update,versions=v1alpha1,name=cdk8sappproxy.kb.io,admissionReviewVersions=v1 -// var _ webhook.CustomDefaulter = &Cdk8sAppProxy{} +// var _ webhook.CustomDefaulter = &Cdk8sAppProxy{}. var _ webhook.Defaulter = &Cdk8sAppProxy{} -// Default implements webhook.CustomDefaulter so a webhook will be registered for the type -func (r *Cdk8sAppProxy) Default() { - cdk8sappproxylog.Info("default", "name", r.Name) +// Default implements webhook.CustomDefaulter so a webhook will be registered for the type. +func (c *Cdk8sAppProxy) Default() { + cdk8sappproxylog.Info("default", "name", c.Name) - // Set default git reference if not specified - if r.Spec.GitRepository != nil && r.Spec.GitRepository.Reference == "" { - r.Spec.GitRepository.Reference = "main" + // Set the default git reference if not specified + if c.Spec.GitRepository != nil && c.Spec.GitRepository.Reference == "" { + c.Spec.GitRepository.Reference = "main" } - // Set default path if not specified - if r.Spec.GitRepository != nil && r.Spec.GitRepository.Path == "" { - r.Spec.GitRepository.Path = "." + // Set the default path if not specified + if c.Spec.GitRepository != nil && c.Spec.GitRepository.Path == "" { + c.Spec.GitRepository.Path = "." } } @@ -43,43 +43,43 @@ func (r *Cdk8sAppProxy) Default() { var _ webhook.Validator = &Cdk8sAppProxy{} -// ValidateCreate implements webhook.CustomValidator so a webhook will be registered for the type -func (r *Cdk8sAppProxy) ValidateCreate() (admission.Warnings, error) { - cdk8sappproxylog.Info("validate create", "name", r.Name) +// ValidateCreate implements webhook.CustomValidator so a webhook will be registered for the type. +func (c *Cdk8sAppProxy) ValidateCreate() (admission.Warnings, error) { + cdk8sappproxylog.Info("validate create", "name", c.Name) - return r.validateCdk8sAppProxy() + return c.validateCdk8sAppProxy() } -// ValidateUpdate implements webhook.CustomValidator so a webhook will be registered for the type -func (r *Cdk8sAppProxy) ValidateUpdate(oldRaw runtime.Object) (admission.Warnings, error) { - cdk8sappproxylog.Info("validate update", "name", r.Name) +// ValidateUpdate implement webhook.CustomValidator so a webhook will be registered for the type. +func (c *Cdk8sAppProxy) ValidateUpdate(oldRaw runtime.Object) (admission.Warnings, error) { + cdk8sappproxylog.Info("validate update", "name", c.Name) - return r.validateCdk8sAppProxy() + return c.validateCdk8sAppProxy() } -// ValidateDelete implements webhook.CustomValidator so a webhook will be registered for the type -func (r *Cdk8sAppProxy) ValidateDelete() (admission.Warnings, error) { - cdk8sappproxylog.Info("validate delete", "name", r.Name) +// ValidateDelete implements webhook.CustomValidator so a webhook will be registered for the type. +func (c *Cdk8sAppProxy) ValidateDelete() (admission.Warnings, error) { + cdk8sappproxylog.Info("validate delete", "name", c.Name) // No validation needed for delete return nil, nil } -func (r *Cdk8sAppProxy) validateCdk8sAppProxy() (admission.Warnings, error) { +func (c *Cdk8sAppProxy) validateCdk8sAppProxy() (admission.Warnings, error) { var allErrs []error // Validate that either LocalPath or GitRepository is specified, but not both - if r.Spec.LocalPath != "" && r.Spec.GitRepository != nil { + if c.Spec.LocalPath != "" && c.Spec.GitRepository != nil { allErrs = append(allErrs, fmt.Errorf("only one of localPath or gitRepository can be specified")) } - if r.Spec.LocalPath == "" && r.Spec.GitRepository == nil { + if c.Spec.LocalPath == "" && c.Spec.GitRepository == nil { allErrs = append(allErrs, fmt.Errorf("either localPath or gitRepository must be specified")) } // Validate GitRepository fields if specified - if r.Spec.GitRepository != nil { - if r.Spec.GitRepository.URL == "" { + if c.Spec.GitRepository != nil { + if c.Spec.GitRepository.URL == "" { allErrs = append(allErrs, fmt.Errorf("gitRepository.url is required when gitRepository is specified")) } } diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index 68a9090..59674fe 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -25,7 +25,7 @@ import ( ) var ( - // GroupVersion is group version used to register these objects. + // GroupVersion is a group version used to register these objects. GroupVersion = schema.GroupVersion{Group: "addons.cluster.x-k8s.io", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme. diff --git a/api/v1alpha1/webhook_suite_test.go b/api/v1alpha1/webhook_suite_test.go new file mode 100644 index 0000000..560cb52 --- /dev/null +++ b/api/v1alpha1/webhook_suite_test.go @@ -0,0 +1,136 @@ +/* +Copyright 2022 The Kubernetes 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 ( + "context" + "crypto/tls" + "fmt" + "net" + "path/filepath" + "testing" + "time" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + admissionv1beta1 "k8s.io/api/admission/v1beta1" + "k8s.io/apimachinery/pkg/runtime" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/envtest" + logf "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" + "sigs.k8s.io/controller-runtime/pkg/webhook" +) + +// These tests use Ginkgo (BDD-style Go testing framework). Refer to +// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. + +var ( + k8sClient client.Client + testEnv *envtest.Environment + ctx context.Context + cancel context.CancelFunc +) + +func TestAPIs(t *testing.T) { + RegisterFailHandler(Fail) + + RunSpecs(t, "Webhook Suite") +} + +var _ = BeforeSuite(func() { + logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) + + ctx, cancel = context.WithCancel(context.TODO()) + + By("bootstrapping test environment") + testEnv = &envtest.Environment{ + CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")}, + ErrorIfCRDPathMissing: false, + WebhookInstallOptions: envtest.WebhookInstallOptions{ + Paths: []string{filepath.Join("..", "..", "config", "webhook")}, + }, + } + + cfg, err := testEnv.Start() + Expect(err).NotTo(HaveOccurred()) + Expect(cfg).NotTo(BeNil()) + + scheme := runtime.NewScheme() + err = AddToScheme(scheme) + Expect(err).NotTo(HaveOccurred()) + + err = admissionv1beta1.AddToScheme(scheme) + Expect(err).NotTo(HaveOccurred()) + + err = admissionv1beta1.AddToScheme(scheme) + Expect(err).NotTo(HaveOccurred()) + + //+kubebuilder:scaffold:scheme + + k8sClient, err = client.New(cfg, client.Options{Scheme: scheme}) + Expect(err).NotTo(HaveOccurred()) + Expect(k8sClient).NotTo(BeNil()) + + // start webhook server using Manager + webhookInstallOptions := &testEnv.WebhookInstallOptions + mgr, err := ctrl.NewManager(cfg, ctrl.Options{ + Scheme: scheme, + WebhookServer: webhook.NewServer( + webhook.Options{ + Host: webhookInstallOptions.LocalServingHost, + Port: webhookInstallOptions.LocalServingPort, + CertDir: webhookInstallOptions.LocalServingCertDir, + }, + ), + LeaderElection: false, + Metrics: metricsserver.Options{BindAddress: "0"}, + }) + Expect(err).NotTo(HaveOccurred()) + + err = (&Cdk8sAppProxy{}).SetupWebhookWithManager(mgr) + Expect(err).NotTo(HaveOccurred()) + + //+kubebuilder:scaffold:webhook + + go func() { + defer GinkgoRecover() + err = mgr.Start(ctx) + Expect(err).NotTo(HaveOccurred()) + }() + + // wait for the webhook server to get ready + dialer := &net.Dialer{Timeout: time.Second} + addrPort := fmt.Sprintf("%s:%d", webhookInstallOptions.LocalServingHost, webhookInstallOptions.LocalServingPort) + Eventually(func() error { + conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true}) + if err != nil { + return err + } + + return conn.Close() + }).Should(Succeed()) +}) + +var _ = AfterSuite(func() { + cancel() + By("tearing down the test environment") + err := testEnv.Stop() + Expect(err).NotTo(HaveOccurred()) +}) diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index a89009e..3836dbf 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -27,27 +27,27 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Cdk8sAppProxy) DeepCopyInto(out *Cdk8sAppProxy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) +func (c *Cdk8sAppProxy) DeepCopyInto(out *Cdk8sAppProxy) { + *out = *c + out.TypeMeta = c.TypeMeta + c.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + c.Spec.DeepCopyInto(&out.Spec) + c.Status.DeepCopyInto(&out.Status) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cdk8sAppProxy. -func (in *Cdk8sAppProxy) DeepCopy() *Cdk8sAppProxy { - if in == nil { +func (c *Cdk8sAppProxy) DeepCopy() *Cdk8sAppProxy { + if c == nil { return nil } out := new(Cdk8sAppProxy) - in.DeepCopyInto(out) + c.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Cdk8sAppProxy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { +func (c *Cdk8sAppProxy) DeepCopyObject() runtime.Object { + if c := c.DeepCopy(); c != nil { return c } return nil diff --git a/cloudbuild.yaml b/cloudbuild.yaml deleted file mode 100644 index 81f3f4f..0000000 --- a/cloudbuild.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# See https://cloud.google.com/cloud-build/docs/build-config -# See https://console.cloud.google.com/gcr/images/k8s-staging-test-infra/global/gcb-docker-gcloud -timeout: 2700s -options: - substitution_option: ALLOW_LOOSE - machineType: 'N1_HIGHCPU_8' -steps: - - name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20221007-ad65926f6b' - entrypoint: make - env: - - DOCKER_CLI_EXPERIMENTAL=enabled - - TAG=$_GIT_TAG - - PULL_BASE_REF=$_PULL_BASE_REF - - DOCKER_BUILDKIT=1 - args: - - release-staging -substitutions: - # _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and - # can be used as a substitution - _GIT_TAG: '12345' - _PULL_BASE_REF: 'dev' diff --git a/config/default/manager_image_patch.yaml b/config/default/manager_image_patch.yaml index 9405302..d768a40 100644 --- a/config/default/manager_image_patch.yaml +++ b/config/default/manager_image_patch.yaml @@ -7,5 +7,5 @@ spec: template: spec: containers: - - image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.2.4-alpha + - image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.2.11-preview name: manager diff --git a/config/default/manager_image_patch.yaml-e b/config/default/manager_image_patch.yaml-e index 9405302..d768a40 100644 --- a/config/default/manager_image_patch.yaml-e +++ b/config/default/manager_image_patch.yaml-e @@ -7,5 +7,5 @@ spec: template: spec: containers: - - image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.2.4-alpha + - image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.2.11-preview name: manager diff --git a/config/default/manager_pull_policy.yaml-e b/config/default/manager_pull_policy.yaml-e index cd7ae12..74a0879 100644 --- a/config/default/manager_pull_policy.yaml-e +++ b/config/default/manager_pull_policy.yaml-e @@ -8,4 +8,4 @@ spec: spec: containers: - name: manager - imagePullPolicy: IfNotPresent + imagePullPolicy: Always diff --git a/controllers/cdk8sappproxy/cdk8sappproxy_consts.go b/controllers/cdk8sappproxy/cdk8sappproxy_consts.go new file mode 100644 index 0000000..c0dfa34 --- /dev/null +++ b/controllers/cdk8sappproxy/cdk8sappproxy_consts.go @@ -0,0 +1,21 @@ +package cdk8sappproxy + +import "time" + +// Finalizer is the finalizer used by the cdk8sappproxy controller. +const ( + Finalizer = "cdk8sappproxy.addons.cluster.x-k8s.io/finalizer" +) + +// Operation represents the type of operation being performed by the cdk8sappproxy controller. +const ( + OperationDeletion = "deletion" + OperationNormal = "normal" + OperationPolling = "polling" + OperationFindFiles = "findFiles" + OperationSynthesize = "synthesize" + OperationApply = "apply" +) + +// gitPollInterval is the interval at which the cdk8sappproxy controller polls the git repository for changes. +const gitPollInterval = 1 * time.Minute diff --git a/controllers/cdk8sappproxy/cdk8sappproxy_controller.go b/controllers/cdk8sappproxy/cdk8sappproxy_controller.go new file mode 100644 index 0000000..5f9cd24 --- /dev/null +++ b/controllers/cdk8sappproxy/cdk8sappproxy_controller.go @@ -0,0 +1,538 @@ +/* +Copyright 2023 The Kubernetes 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 cdk8sappproxy + +import ( + "bytes" + "context" + "io/fs" + "os" + "os/exec" + "path/filepath" + "strings" + + addonsv1alpha1 "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/api/v1alpha1" + "github.com/go-logr/logr" + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + k8syaml "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/tools/clientcmd" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/cluster-api/util/conditions" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/log" +) + +// CommandExecutor defines an interface for running external commands. +type CommandExecutor interface { + CombinedOutput() ([]byte, error) + SetDir(dir string) +} + +// RealCmdRunner is a concrete implementation of CommandExecutor that runs actual commands. +type RealCmdRunner struct { + Name string + Args []string + Dir string + CommanderFunc func(command string, args ...string) ([]byte, error) +} + +func (rcr *RealCmdRunner) SetDir(dir string) { + rcr.Dir = dir +} + +func (rcr *RealCmdRunner) CombinedOutput() ([]byte, error) { + if rcr.CommanderFunc != nil { + return rcr.CommanderFunc(rcr.Name, rcr.Args...) + } + cmd := exec.Command(rcr.Name, rcr.Args...) + if rcr.Dir != "" { + cmd.Dir = rcr.Dir + } + + return cmd.CombinedOutput() +} + +var cmdRunnerFactory = func(name string, args ...string) CommandExecutor { + return &RealCmdRunner{Name: name, Args: args} +} + +func (r *Reconciler) getCdk8sAppProxyForPolling(ctx context.Context, proxyName types.NamespacedName) (*addonsv1alpha1.Cdk8sAppProxy, error) { + cdk8sAppProxy := &addonsv1alpha1.Cdk8sAppProxy{} + if err := r.Get(ctx, proxyName, cdk8sAppProxy); err != nil { + if apierrors.IsNotFound(err) { + return nil, nil + } + + return nil, err + } + + return cdk8sAppProxy, nil +} + +// checkIfResourceExists checks if a given resource exists on the target cluster. It uses a dynamic client to make the check. +func checkIfResourceExists(ctx context.Context, dynClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string, name string) (bool, error) { + resourceGetter := dynClient.Resource(gvr) + if namespace != "" { + _, err := resourceGetter.Namespace(namespace).Get(ctx, name, metav1.GetOptions{}) + if err != nil { + if apierrors.IsNotFound(err) { + return false, nil // Resource does not exist + } + // Some other error occurred + return false, errors.Wrapf(err, "failed to get namespaced resource %s/%s with GVR %s", namespace, name, gvr.String()) + } + } else { + _, err := resourceGetter.Get(ctx, name, metav1.GetOptions{}) + if err != nil { + if apierrors.IsNotFound(err) { + return false, nil + } + // Some other error occurred + return false, errors.Wrapf(err, "failed to get cluster-scoped resource %s with GVR %s", name, gvr.String()) + } + } + + return true, nil +} + +func (r *Reconciler) synthesizeAndParseResources(appSourcePath string, logger logr.Logger) ([]*unstructured.Unstructured, error) { + // Synthesize cdk8s application + if err := r.synthesizeCdk8sApp(appSourcePath, logger, OperationSynthesize); err != nil { + return nil, err + } + + // Find manifest files + manifestFiles, err := r.findManifestFiles(appSourcePath, logger, OperationFindFiles) + if err != nil { + return nil, err + } + + // Parse resources from manifest files using the consolidated function + return r.parseManifestFiles(manifestFiles, logger, OperationSynthesize) +} + +func (r *Reconciler) synthesizeCdk8sApp(appSourcePath string, logger logr.Logger, operation string) error { + logger.Info("Synthesizing cdk8s application", "effectiveSourcePath", appSourcePath, "operation", operation) + + synthCmd := cmdRunnerFactory("cdk8s", "synth") + synthCmd.SetDir(appSourcePath) + output, synthErr := synthCmd.CombinedOutput() + if synthErr != nil { + logger.Error(synthErr, "cdk8s synth failed", "output", string(output), "operation", operation) + + return synthErr + } + + logger.Info("cdk8s synth successful", "outputSummary", truncateString(string(output), 200), "operation", operation) + logger.V(1).Info("cdk8s synth full output", "output", string(output), "operation", operation) + + return nil +} + +func (r *Reconciler) findManifestFiles(appSourcePath string, logger logr.Logger, operation string) ([]string, error) { + distPath := filepath.Join(appSourcePath, "dist") + logger.Info("Looking for manifests for deletion", "distPath", distPath, "operation", operation) + + var manifestFiles []string + walkErr := filepath.WalkDir(distPath, func(path string, d fs.DirEntry, err error) error { + if err != nil { + return err + } + if !d.IsDir() && (strings.HasSuffix(d.Name(), ".yaml") || strings.HasSuffix(d.Name(), ".yml")) { + manifestFiles = append(manifestFiles, path) + } + + return nil + }) + + if walkErr != nil { + logger.Error(walkErr, "Failed to walk dist directory", "operation", operation) + + return nil, walkErr + } + + logger.Info("Found manifest files", "count", len(manifestFiles), "operation", operation) + + return manifestFiles, nil +} + +func (r *Reconciler) parseManifestFiles(manifestFiles []string, logger logr.Logger, operation string) ([]*unstructured.Unstructured, error) { + var parsedResources []*unstructured.Unstructured + + for _, manifestFile := range manifestFiles { + resources, err := r.parseManifestFile(manifestFile, logger, operation) + if err != nil { + return nil, err + } + parsedResources = append(parsedResources, resources...) + } + + logger.Info("Total resources parsed", "count", len(parsedResources), "operation", operation) + + return parsedResources, nil +} + +func (r *Reconciler) parseManifestFile(manifestFile string, logger logr.Logger, operation string) ([]*unstructured.Unstructured, error) { + logger.Info("Processing manifest file", "file", manifestFile, "operation", operation) + + fileContent, readErr := os.ReadFile(manifestFile) + if readErr != nil { + logger.Error(readErr, "Failed to read manifest file", "file", manifestFile, "operation", operation) + + return nil, readErr + } + + var parsedResources []*unstructured.Unstructured + yamlDecoder := k8syaml.NewYAMLOrJSONDecoder(bytes.NewReader(fileContent), 100) + + for { + var rawObj runtime.RawExtension + if err := yamlDecoder.Decode(&rawObj); err != nil { + if err.Error() == "EOF" { + break + } + logger.Error(err, "Failed to decode YAML from manifest file", "file", manifestFile, "operation", operation) + + return nil, err + } + + if rawObj.Raw == nil { + continue + } + + u := &unstructured.Unstructured{} + if _, _, err := unstructured.UnstructuredJSONScheme.Decode(rawObj.Raw, nil, u); err != nil { + logger.Error(err, "Failed to decode RawExtension to Unstructured", "file", manifestFile, "operation", operation) + + return nil, err + } + + parsedResources = append(parsedResources, u) + logger.Info("Parsed resource", "GVK", u.GroupVersionKind().String(), "Name", u.GetName(), "Namespace", u.GetNamespace(), "operation", operation) + } + + return parsedResources, nil +} + +func (r *Reconciler) deleteResourcesFromClusters(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, parsedResources []*unstructured.Unstructured, logger logr.Logger) error { + // Get target clusters + clusterList, err := r.getTargetClustersForDeletion(ctx, cdk8sAppProxy, logger) + if err != nil { + return err + } + + // Delete resources from each cluster + for _, cluster := range clusterList.Items { + if err := r.deleteResourcesFromSingleCluster(ctx, cdk8sAppProxy, cluster, parsedResources, logger); err != nil { + // Log error but continue with other clusters + logger.Error(err, "Failed to delete resources from cluster", "cluster", cluster.Name) + } + } + + return nil +} + +func (r *Reconciler) getTargetClustersForDeletion(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, logger logr.Logger) (*clusterv1.ClusterList, error) { + clusterList := &clusterv1.ClusterList{} + selector, err := metav1.LabelSelectorAsSelector(&cdk8sAppProxy.Spec.ClusterSelector) + if err != nil { + logger.Error(err, "failed to parse ClusterSelector during deletion") + + return nil, err + } + + logger.Info("Listing clusters for deletion", "selector", selector.String(), "namespace", cdk8sAppProxy.Namespace) + if err := r.List(ctx, clusterList, client.MatchingLabelsSelector{Selector: selector}, client.InNamespace(cdk8sAppProxy.Namespace)); err != nil { + logger.Error(err, "Failed to list clusters during deletion, requeuing") + + return nil, err + } + + clusterNames := make([]string, 0, len(clusterList.Items)) + for _, c := range clusterList.Items { + clusterNames = append(clusterNames, c.Name) + } + logger.Info("Found clusters for deletion", "count", len(clusterList.Items), "names", clusterNames) + + return clusterList, nil +} + +func (r *Reconciler) deleteResourcesFromSingleCluster(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, cluster clusterv1.Cluster, parsedResources []*unstructured.Unstructured, logger logr.Logger) error { + clusterLogger := logger.WithValues("targetCluster", cluster.Name) + clusterLogger.Info("Deleting resources from cluster") + + dynamicClient, err := r.getDynamicClientForCluster(ctx, cdk8sAppProxy.Namespace, cluster.Name) + if err != nil { + clusterLogger.Error(err, "Failed to get dynamic client for cluster during deletion, skipping this cluster") + + return err + } + + clusterLogger.Info("Successfully created dynamic client for cluster deletion") + + for _, resource := range parsedResources { + if err := r.deleteResourceFromCluster(ctx, dynamicClient, resource, clusterLogger); err != nil { + // Log but continue with other resources + clusterLogger.Error(err, "Failed to delete resource from cluster", "resourceName", resource.GetName()) + } + } + + return nil +} + +func (r *Reconciler) deleteResourceFromCluster(ctx context.Context, dynamicClient dynamic.Interface, resource *unstructured.Unstructured, logger logr.Logger) error { + gvr := resource.GroupVersionKind().GroupVersion().WithResource(getPluralFromKind(resource.GetKind())) + logger.Info("Deleting resource from cluster", "GVK", resource.GroupVersionKind().String(), "Name", resource.GetName(), "Namespace", resource.GetNamespace()) + + err := dynamicClient.Resource(gvr).Namespace(resource.GetNamespace()).Delete(ctx, resource.GetName(), metav1.DeleteOptions{}) + + switch { + case err != nil && !apierrors.IsNotFound(err): + logger.Error(err, "Failed to delete resource from cluster", "resourceName", resource.GetName()) + + return err + case apierrors.IsNotFound(err): + logger.Info("Resource already deleted from cluster", "resourceName", resource.GetName()) + case err == nil: + logger.Info("Successfully deleted resource from cluster", "resourceName", resource.GetName()) + } + + return nil +} + +func (r *Reconciler) finalizeDeletion(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, proxyNamespacedName types.NamespacedName, logger logr.Logger) (ctrl.Result, error) { + // Cancel any active watches for this Cdk8sAppProxy + r.cancelActiveWatches(proxyNamespacedName, logger) + + // Remove finalizer + return r.removeFinalizer(ctx, cdk8sAppProxy, logger) +} + +func (r *Reconciler) cancelActiveWatches(proxyNamespacedName types.NamespacedName, logger logr.Logger) { + if watchesForProxy, ok := r.ActiveWatches[proxyNamespacedName]; ok { + logger.Info("Cancelling active watches for Cdk8sAppProxy before deletion", "count", len(watchesForProxy)) + for watchKey, cancelFunc := range watchesForProxy { + logger.Info("Cancelling watch", "watchKey", watchKey) + cancelFunc() // Stop the goroutine and its associated Kubernetes watch + } + // After all, watches for this proxy are canceled, remove its entry from the main map + delete(r.ActiveWatches, proxyNamespacedName) + logger.Info("Removed Cdk8sAppProxy entry from ActiveWatches map") + } else { + logger.Info("No active watches found for this Cdk8sAppProxy to cancel.") + } +} + +func (r *Reconciler) removeFinalizer(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, logger logr.Logger) (ctrl.Result, error) { + logger.Info("Finished deletion logic, removing finalizer") + controllerutil.RemoveFinalizer(cdk8sAppProxy, Finalizer) + if err := r.Update(ctx, cdk8sAppProxy); err != nil { + logger.Error(err, "Failed to remove finalizer") + + return ctrl.Result{}, err + } + logger.Info("Finalizer removed successfully") + + return ctrl.Result{}, nil +} + +func (r *Reconciler) getDynamicClientForCluster(ctx context.Context, secretNamespace, clusterName string) (dynamic.Interface, error) { + logger := log.FromContext(ctx).WithValues("secretNamespace", secretNamespace, "clusterName", clusterName) + kubeconfigSecretName := clusterName + "-kubeconfig" + logger.Info("Attempting to get Kubeconfig secret", "secretName", kubeconfigSecretName) + kubeconfigSecret := &corev1.Secret{} + if err := r.Get(ctx, client.ObjectKey{Namespace: secretNamespace, Name: kubeconfigSecretName}, kubeconfigSecret); err != nil { + logger.Error(err, "Failed to get Kubeconfig secret") + + return nil, errors.Wrapf(err, "failed to get kubeconfig secret %s/%s", secretNamespace, kubeconfigSecretName) + } + kubeconfigData, ok := kubeconfigSecret.Data["value"] + if !ok || len(kubeconfigData) == 0 { + newErr := errors.Errorf("kubeconfig secret %s/%s does not contain 'value' data", secretNamespace, kubeconfigSecretName) + logger.Error(newErr, "Invalid Kubeconfig secret") + + return nil, newErr + } + logger.Info("Successfully retrieved Kubeconfig data") + restConfig, err := clientcmd.RESTConfigFromKubeConfig(kubeconfigData) + if err != nil { + logger.Error(err, "Failed to create REST config from Kubeconfig") + + return nil, errors.Wrapf(err, "failed to create REST config from kubeconfig for cluster %s", clusterName) + } + logger.Info("Successfully created REST config") + dynamicClient, err := dynamic.NewForConfig(restConfig) + if err != nil { + logger.Error(err, "Failed to create dynamic client") + + return nil, errors.Wrapf(err, "failed to create dynamic client for cluster %s", clusterName) + } + logger.Info("Successfully created dynamic client") + + return dynamicClient, nil +} + +// Consolidated error handling. +func (r *Reconciler) updateStatusWithError(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, reason, message string, err error, removeFinalizer bool) error { + logger := log.FromContext(ctx).WithValues("cdk8sappproxy", types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}) + + if err != nil { + logger.Error(err, message, "reason", reason) + conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, reason, clusterv1.ConditionSeverityError, "%s: %v", message, err) + } else { + logger.Info(message, "reason", reason) + } + + if removeFinalizer { + controllerutil.RemoveFinalizer(cdk8sAppProxy, Finalizer) + if updateErr := r.Update(ctx, cdk8sAppProxy); updateErr != nil { + logger.Error(updateErr, "Failed to remove finalizer after error") + + return updateErr + } + logger.Info("Removed finalizer after error/condition") + } else { + if statusUpdateErr := r.Status().Update(ctx, cdk8sAppProxy); statusUpdateErr != nil { + logger.Error(statusUpdateErr, "Failed to update status after error") + } + } + + return err +} + +func truncateString(str string, num int) string { + if len(str) > num { + return str[0:num] + "..." + } + + return str +} + +// TODO: This is a naive pluralization and might not work for all kinds. +// A more robust solution would use discovery client or a predefined map. +func getPluralFromKind(kind string) string { + lowerKind := strings.ToLower(kind) + if strings.HasSuffix(lowerKind, "s") { + return lowerKind + "es" + } + if strings.HasSuffix(lowerKind, "y") { + return strings.TrimSuffix(lowerKind, "y") + "ies" + } + + return lowerKind + "s" +} + +// SetupWithManager sets up the controller with the Manager. +func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { + // Initialize a watch system before setting up the controller + r.initializeWatchSystem() + + return ctrl.NewControllerManagedBy(mgr). + For(&addonsv1alpha1.Cdk8sAppProxy{}). + Watches(&clusterv1.Cluster{}, + handler.EnqueueRequestsFromMapFunc(r.ClusterToCdk8sAppProxyMapper)). + Complete(r) +} + +func (r *Reconciler) initializeWatchSystem() { + // Create event handler with nil manager initially + eventHandler := NewEventHandler(r.Client, nil) + + // Create resource watcher + resourceWatcher := NewResourceWatcher(eventHandler) + + // Create the actual watch manager + watchManager := NewWatchManager(resourceWatcher) + + // Update the event handler with the real manager using the interface method + eventHandler.SetWatchManager(watchManager) + + // Set on reconciler + r.WatchManager = watchManager +} + +// ClusterToCdk8sAppProxyMapper is a handler.ToRequestsFunc to be used to enqeue requests for Cdk8sAppProxyReconciler. +// It maps CAPI Cluster events to Cdk8sAppProxy events. +func (r *Reconciler) ClusterToCdk8sAppProxyMapper(ctx context.Context, o client.Object) []ctrl.Request { + logger := log.FromContext(ctx) + cluster, ok := o.(*clusterv1.Cluster) + if !ok { + logger.Error(errors.Errorf("unexpected type %T, expected Cluster", o), "failed to cast object to Cluster", "object", o) + + return nil + } + + logger = logger.WithValues("clusterName", cluster.Name, "clusterNamespace", cluster.Namespace) + logger.Info("ClusterToCdk8sAppProxyMapper triggered for cluster") + + proxies := &addonsv1alpha1.Cdk8sAppProxyList{} + // List all Cdk8sAppProxies in the same namespace as the Cluster. + // Adjust if Cdk8sAppProxy can be in a different namespace or cluster-scoped. + // For now, assuming Cdk8sAppProxy is namespace-scoped and in the same namespace as the triggering Cluster's Cdk8sAppProxy object (which is usually the management cluster's default namespace). + // However, Cdk8sAppProxy resources themselves select clusters across namespaces. + // So, we should list Cdk8sAppProxies from all namespaces if the controller has cluster-wide watch permissions for them. + // If the controller is namespace-scoped for Cdk8sAppProxy, this list will be limited. + // For this example, let's assume a cluster-wide list for Cdk8sAppProxy. + if err := r.List(ctx, proxies); err != nil { // staticcheck: QF1008 + logger.Error(err, "failed to list Cdk8sAppProxies") + + return nil + } + logger.Info("Checking Cdk8sAppProxies for matches", "count", len(proxies.Items)) + + var requests []ctrl.Request + for _, proxy := range proxies.Items { + proxyLogger := logger.WithValues("cdk8sAppProxyName", proxy.Name, "cdk8sAppProxyNamespace", proxy.Namespace) + proxyLogger.Info("Evaluating Cdk8sAppProxy") + + selector, err := metav1.LabelSelectorAsSelector(&proxy.Spec.ClusterSelector) + if err != nil { + proxyLogger.Error(err, "failed to parse ClusterSelector for Cdk8sAppProxy") + + continue + } + proxyLogger.Info("Parsed ClusterSelector", "selector", selector.String()) + + if selector.Matches(labels.Set(cluster.GetLabels())) { + proxyLogger.Info("Cluster labels match Cdk8sAppProxy selector, enqueuing request") + requests = append(requests, ctrl.Request{ + NamespacedName: client.ObjectKey{ + Namespace: proxy.Namespace, + Name: proxy.Name, + }, + }) + } else { + proxyLogger.Info("Cluster labels do not match Cdk8sAppProxy selector") + } + } + + logger.Info("ClusterToCdk8sAppProxyMapper finished", "requestsEnqueued", len(requests)) + + return requests +} diff --git a/controllers/cdk8sappproxy/cdk8sappproxy_git_operator.go b/controllers/cdk8sappproxy/cdk8sappproxy_git_operator.go new file mode 100644 index 0000000..6e6e073 --- /dev/null +++ b/controllers/cdk8sappproxy/cdk8sappproxy_git_operator.go @@ -0,0 +1,413 @@ +package cdk8sappproxy + +import ( + "bytes" + "context" + "os" + "path/filepath" + "strings" + "time" + + addonsv1alpha1 "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/api/v1alpha1" + "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5/config" + "github.com/go-git/go-git/v5/plumbing" + plumbingtransport "github.com/go-git/go-git/v5/plumbing/transport" + "github.com/go-git/go-git/v5/plumbing/transport/http" + "github.com/go-git/go-git/v5/storage/memory" + "github.com/go-logr/logr" + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/log" +) + +func (r *Reconciler) getGitAuth(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, authSecretRef *corev1.LocalObjectReference, logger logr.Logger, operation string) (*http.BasicAuth, error) { + if authSecretRef == nil { + return &http.BasicAuth{}, nil + } + + logger.Info("AuthSecretRef specified, attempting to fetch secret", "secretName", authSecretRef.Name, "operation", operation) + + authSecret := &corev1.Secret{} + secretKey := client.ObjectKey{Namespace: cdk8sAppProxy.Namespace, Name: authSecretRef.Name} + if err := r.Get(ctx, secretKey, authSecret); err != nil { + logger.Error(err, "Failed to get auth secret", "secretName", secretKey.String(), "operation", operation) + + return nil, err + } + + username, okUser := authSecret.Data["username"] + password, okPass := authSecret.Data["password"] + + if !okUser || !okPass { + err := errors.New("auth secret missing username or password fields") + logger.Error(err, "Invalid auth secret", "secretName", secretKey.String(), "operation", operation) + + return nil, err + } + + logger.Info("Successfully fetched auth secret", "operation", operation) + + return &http.BasicAuth{ + Username: string(username), + Password: string(password), + }, nil +} + +func (r *Reconciler) cloneGitRepository(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, gitSpec *addonsv1alpha1.GitRepositorySpec, tempDir string, logger logr.Logger, operation string) error { + cloneOptions := &git.CloneOptions{ + URL: gitSpec.URL, + Progress: &gitProgressLogger{logger: logger.WithName("git-clone")}, + } + + // Handle authentication if needed + if gitSpec.AuthSecretRef != nil { + auth, err := r.getGitAuth(ctx, cdk8sAppProxy, gitSpec.AuthSecretRef, logger, operation) + if err != nil { + return err + } + cloneOptions.Auth = auth + } + + logger.Info("Executing git clone with go-git", "url", gitSpec.URL, "targetDir", tempDir, "operation", operation) + + _, err := git.PlainCloneContext(ctx, tempDir, false, cloneOptions) + if err != nil { + logger.Error(err, "go-git PlainCloneContext failed", "operation", operation) + reason := addonsv1alpha1.GitCloneFailedReason + if errors.Is(err, plumbingtransport.ErrAuthenticationRequired) || strings.Contains(err.Error(), "authentication required") { + reason = addonsv1alpha1.GitAuthenticationFailedReason + } + + // Only call updateStatusWithError if we have a valid cdk8sAppProxy (not during deletion cleanup) + if cdk8sAppProxy != nil { + // Determine if we should remove finalizer based on operation + removeFinalizer := operation == OperationDeletion + + return r.updateStatusWithError(ctx, cdk8sAppProxy, reason, "go-git clone failed during "+operation, err, removeFinalizer) + } + + return err + } + logger.Info("Successfully cloned git repository with go-git", "operation", operation) + + return nil +} + +// pollGitRepository periodically checks the remote git repository for changes. +func (r *Reconciler) pollGitRepository(ctx context.Context, proxyName types.NamespacedName) { + logger := log.FromContext(ctx).WithValues("cdk8sappproxy", proxyName.String(), "goroutine", "pollGitRepository") + logger.Info("Starting git repository polling loop") + + ticker := time.NewTicker(gitPollInterval) + defer ticker.Stop() + + for { + select { + case <-ticker.C: + if err := r.pollGitRepositoryOnce(ctx, proxyName, logger); err != nil { + logger.Error(err, "Error during git repository polling") + } + case <-ctx.Done(): + logger.Info("Stopping git repository polling loop due to context cancellation.") + + return + } + } +} + +func (r *Reconciler) pollGitRepositoryOnce(ctx context.Context, proxyName types.NamespacedName, logger logr.Logger) error { + logger.Info("Polling git repository for changes") + + cdk8sAppProxy, err := r.getCdk8sAppProxyForPolling(ctx, proxyName) + if err != nil { + return err + } + + if cdk8sAppProxy == nil { + logger.Info("Cdk8sAppProxy resource not found, stopping polling.") + + return errors.New("resource not found") + } + + if !r.isGitRepositoryConfigured(cdk8sAppProxy, logger) { + return errors.New("git repository not configured") + } + + gitSpec := cdk8sAppProxy.Spec.GitRepository + refName := r.determineGitReference(gitSpec, logger) + + remoteCommitHash, err := r.fetchRemoteCommitHash(ctx, cdk8sAppProxy, gitSpec, refName, logger) + if err != nil { + return err + } + + return r.handleGitRepositoryChange(ctx, proxyName, cdk8sAppProxy, remoteCommitHash, logger) +} + +func (r *Reconciler) prepareSourceForDeletion(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, logger logr.Logger) (string, func(), error) { + if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" { + return r.prepareGitSourceForDeletion(ctx, cdk8sAppProxy, logger) + } else if cdk8sAppProxy.Spec.LocalPath != "" { + return cdk8sAppProxy.Spec.LocalPath, func() {}, nil + } + + err := errors.New("neither GitRepository nor LocalPath specified, cannot determine resources to delete") + logger.Info(err.Error()) + _ = r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.SourceNotSpecifiedReason, "Cannot determine resources to delete during deletion", err, true) + + return "", func() {}, err +} + +func (r *Reconciler) prepareGitSourceForDeletion(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, logger logr.Logger) (string, func(), error) { + gitSpec := cdk8sAppProxy.Spec.GitRepository + logger.Info("Using GitRepository source for deletion logic", "url", gitSpec.URL, "reference", gitSpec.Reference, "path", gitSpec.Path) + + tempDir, err := os.MkdirTemp("", "cdk8s-git-delete-") + if err != nil { + logger.Error(err, "failed to create temp dir for git clone during deletion") + + return "", func() {}, err + } + + cleanupFunc := func() { + logger.Info("Removing temporary clone directory for deletion", "tempDir", tempDir) + if err := os.RemoveAll(tempDir); err != nil { + logger.Error(err, "Failed to remove temporary clone directory for deletion", "tempDir", tempDir) + } + } + + logger.Info("Created temporary directory for clone during deletion", "tempDir", tempDir) + + if err := r.cloneGitRepository(ctx, nil, gitSpec, tempDir, logger, OperationDeletion); err != nil { + cleanupFunc() + + return "", func() {}, err + } + + if err := r.checkoutGitReference(ctx, nil, gitSpec, tempDir, logger, OperationDeletion); err != nil { + cleanupFunc() + + return "", func() {}, err + } + + appSourcePath := tempDir + if gitSpec.Path != "" { + appSourcePath = filepath.Join(tempDir, gitSpec.Path) + logger.Info("Adjusted appSourcePath for deletion", "subPath", gitSpec.Path, "finalPath", appSourcePath) + } + + return appSourcePath, cleanupFunc, nil +} + +func (r *Reconciler) findRemoteCommitHash(refs []*plumbing.Reference, refName plumbing.ReferenceName, logger logr.Logger) (string, error) { + var remoteCommitHash string + foundRef := false + + for _, ref := range refs { + if ref.Name() == refName { + remoteCommitHash = ref.Hash().String() + foundRef = true + logger.Info("Found matching reference in LsRemote output", "refName", refName.String(), "remoteCommitHash", remoteCommitHash) + + break + } + } + + if !foundRef { + foundRef, remoteCommitHash = r.tryFindDefaultBranch(refs, refName, logger) + } + + if !foundRef { + logger.Info("Specified reference not found in LsRemote output.", "refName", refName.String()) + + return "", errors.New("reference not found") + } + + if remoteCommitHash == "" { + logger.Info("Remote commit hash is empty after LsRemote, skipping update check.") + + return "", errors.New("empty commit hash") + } + + return remoteCommitHash, nil +} + +func (r *Reconciler) tryFindDefaultBranch(refs []*plumbing.Reference, refName plumbing.ReferenceName, logger logr.Logger) (bool, string) { + if refName != plumbing.HEAD { + return false, "" + } + + logger.Info("HEAD reference not explicitly found, searching for default branches like main/master.") + defaultBranches := []plumbing.ReferenceName{ + plumbing.NewBranchReferenceName("main"), + plumbing.NewBranchReferenceName("master"), + } + + for _, defaultBranchRef := range defaultBranches { + for _, ref := range refs { + if ref.Name() == defaultBranchRef { + remoteCommitHash := ref.Hash().String() + logger.Info("Found default branch reference", "refName", defaultBranchRef.String(), "remoteCommitHash", remoteCommitHash) + + return true, remoteCommitHash + } + } + } + + return false, "" +} + +func (r *Reconciler) handleGitRepositoryChange(ctx context.Context, proxyName types.NamespacedName, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, remoteCommitHash string, logger logr.Logger) error { + if cdk8sAppProxy.Status.LastRemoteGitHash == remoteCommitHash { + logger.Info("No change detected in remote git repository.", "currentRemoteHash", remoteCommitHash) + + return nil + } + + logger.Info("Detected change in remote git repository", "oldHash", cdk8sAppProxy.Status.LastRemoteGitHash, "newHash", remoteCommitHash) + + if err := r.updateRemoteGitHashStatus(ctx, proxyName, remoteCommitHash, logger); err != nil { + return err + } + + return r.triggerReconciliation(ctx, proxyName, logger) +} + +func (r *Reconciler) isGitRepositoryConfigured(cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, logger logr.Logger) bool { + if cdk8sAppProxy.Spec.GitRepository == nil || cdk8sAppProxy.Spec.GitRepository.URL == "" { + logger.Info("GitRepository not configured for this Cdk8sAppProxy, stopping polling.") + + return false + } + + return true +} + +func (r *Reconciler) determineGitReference(gitSpec *addonsv1alpha1.GitRepositorySpec, logger logr.Logger) plumbing.ReferenceName { + refName := plumbing.HEAD + if gitSpec.Reference == "" { + return refName + } + + switch { + case plumbing.IsHash(gitSpec.Reference): + logger.Info("Polling a specific commit hash is not actively supported. The poller will check if the remote still has this hash, but it won't detect 'new' commits beyond this specific one. If you want to track a branch, please specify a branch name.", "reference", gitSpec.Reference) + refName = plumbing.ReferenceName(gitSpec.Reference) + case strings.HasPrefix(gitSpec.Reference, "refs/"): + refName = plumbing.ReferenceName(gitSpec.Reference) + case strings.Contains(gitSpec.Reference, "/"): + refName = plumbing.ReferenceName(gitSpec.Reference) + default: + logger.Info("Assuming Git reference is a branch name, prepending 'refs/heads/' for LsRemote.", "reference", gitSpec.Reference) + refName = plumbing.NewBranchReferenceName(gitSpec.Reference) + } + + return refName +} + +func (r *Reconciler) fetchRemoteCommitHash(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, gitSpec *addonsv1alpha1.GitRepositorySpec, refName plumbing.ReferenceName, logger logr.Logger) (string, error) { + logger.Info("Attempting to LsRemote", "url", gitSpec.URL, "refName", refName.String()) + + rem := git.NewRemote(memory.NewStorage(), &config.RemoteConfig{ + URLs: []string{gitSpec.URL}, + }) + + auth, err := r.getGitAuth(ctx, cdk8sAppProxy, gitSpec.AuthSecretRef, logger, "fetchRemoteCommitHash") + if err != nil { + return "", err + } + + refs, err := rem.ListContext(ctx, &git.ListOptions{Auth: auth}) + if err != nil { + logger.Error(err, "Failed to LsRemote from git repository") + if errors.Is(err, plumbingtransport.ErrAuthenticationRequired) || strings.Contains(err.Error(), "authentication required") { + logger.Info("Authentication failed for LsRemote. Please check credentials.") + } + + return "", err + } + + return r.findRemoteCommitHash(refs, refName, logger) +} + +func (r *Reconciler) manageGitPollerLifecycle(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, proxyNamespacedName types.NamespacedName, logger logr.Logger) { + if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" { + r.startGitPollerIfNeeded(ctx, proxyNamespacedName, logger) + } else { + r.stopGitPollerIfNotNeeded(proxyNamespacedName, logger) + } +} + +func (r *Reconciler) startGitPollerIfNeeded(ctx context.Context, proxyNamespacedName types.NamespacedName, logger logr.Logger) { + if _, pollerExists := r.activeGitPollers[proxyNamespacedName]; !pollerExists { + logger.Info("Starting new git poller.") + pollCtx, cancelPoll := context.WithCancel(ctx) + r.activeGitPollers[proxyNamespacedName] = cancelPoll + go r.pollGitRepository(pollCtx, proxyNamespacedName) + } else { + logger.Info("Git poller already active.") + } +} + +func (r *Reconciler) stopGitPollerIfNotNeeded(proxyNamespacedName types.NamespacedName, logger logr.Logger) { + if cancel, pollerExists := r.activeGitPollers[proxyNamespacedName]; pollerExists { + logger.Info("GitRepository is not configured, ensuring poller is stopped.") + cancel() + delete(r.activeGitPollers, proxyNamespacedName) + } +} + +// You already have this function, but let's also create a helper for explicit stopping. +func (r *Reconciler) stopGitPoller(proxyNamespacedName types.NamespacedName, logger logr.Logger) { + if cancel, pollerExists := r.activeGitPollers[proxyNamespacedName]; pollerExists { + logger.Info("Stopping git poller.") + cancel() + delete(r.activeGitPollers, proxyNamespacedName) + } else { + logger.Info("No active git poller found to stop.") + } +} + +func (r *Reconciler) updateRemoteGitHashStatus(ctx context.Context, proxyName types.NamespacedName, remoteCommitHash string, logger logr.Logger) error { + latestCdk8sAppProxy := &addonsv1alpha1.Cdk8sAppProxy{} + if err := r.Get(ctx, proxyName, latestCdk8sAppProxy); err != nil { + logger.Error(err, "Failed to get latest Cdk8sAppProxy before status update") + + return err + } + + latestCdk8sAppProxy.Status.LastRemoteGitHash = remoteCommitHash + if err := r.Status().Update(ctx, latestCdk8sAppProxy); err != nil { + logger.Error(err, "Failed to update Cdk8sAppProxy status with new remote hash") + + return err + } + + logger.Info("Successfully updated status with new remote hash. Now triggering reconciliation.") + + return nil +} + +func (gpl *gitProgressLogger) Write(p []byte) (n int, err error) { + gpl.buffer = append(gpl.buffer, p...) + for { + idx := bytes.IndexByte(gpl.buffer, '\n') + if idx == -1 { + // If buffer gets too large without a newline, log it to prevent OOM + if len(gpl.buffer) > 1024 { + gpl.logger.Info(strings.TrimSpace(string(gpl.buffer))) + gpl.buffer = nil + } + + break + } + line := gpl.buffer[:idx] + gpl.buffer = gpl.buffer[idx+1:] + gpl.logger.Info(strings.TrimSpace(string(line))) + } + + return len(p), nil +} diff --git a/controllers/cdk8sappproxy/cdk8sappproxy_reconciler.go b/controllers/cdk8sappproxy/cdk8sappproxy_reconciler.go new file mode 100644 index 0000000..72beaec --- /dev/null +++ b/controllers/cdk8sappproxy/cdk8sappproxy_reconciler.go @@ -0,0 +1,787 @@ +package cdk8sappproxy + +import ( + "context" + "os" + "path/filepath" + "time" + + addonsv1alpha1 "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/api/v1alpha1" + "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5/plumbing" + "github.com/go-logr/logr" + "github.com/pkg/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/types" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/cluster-api/util/conditions" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/log" +) + +//+kubebuilder:rbac:groups=addons.cluster.x-k8s.io,resources=cdk8sappproxies,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=addons.cluster.x-k8s.io,resources=cdk8sappproxies/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=addons.cluster.x-k8s.io,resources=cdk8sappproxies/finalizers,verbs=update +//+kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusters,verbs=get;list;watch +//+kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusters/status,verbs=get;list;watch +//+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch + +func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + logger := log.FromContext(ctx).WithValues("cdk8sappproxy", req.NamespacedName) + logger.Info("Starting Reconcile") + + // Initialize activeGitPollers map if it's nil + if r.activeGitPollers == nil { + r.activeGitPollers = make(map[types.NamespacedName]context.CancelFunc) + } + // Initialize ActiveWatches map if it's nil + // Note: This was moved from reconcileNormal to ensure it's initialized before any delete or normal path. + if r.ActiveWatches == nil { + r.ActiveWatches = make(map[types.NamespacedName]map[string]context.CancelFunc) + } + + cdk8sAppProxy := &addonsv1alpha1.Cdk8sAppProxy{} + if err := r.Get(ctx, req.NamespacedName, cdk8sAppProxy); err != nil { + if apierrors.IsNotFound(err) { + logger.Info("Cdk8sAppProxy resource not found. Ignoring since object must be deleted.") + + return ctrl.Result{}, nil + } + logger.Error(err, "Failed to get Cdk8sAppProxy") + + return ctrl.Result{}, errors.Wrapf(err, "failed to get Cdk8sAppProxy %s/%s", req.Namespace, req.Name) + } + + logger = logger.WithValues("name", cdk8sAppProxy.Name, "namespace", cdk8sAppProxy.Namespace) + logger.Info("Fetched Cdk8sAppProxy", "deletionTimestamp", cdk8sAppProxy.DeletionTimestamp) + + if !cdk8sAppProxy.DeletionTimestamp.IsZero() { + logger.Info("Cdk8sAppProxy is being deleted, reconciling delete.") + + return r.reconcileDelete(ctx, cdk8sAppProxy) + } + logger.Info("Cdk8sAppProxy is not being deleted, reconciling normal.") + + return r.reconcileNormal(ctx, cdk8sAppProxy) +} + +func (r *Reconciler) reconcileDelete(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy) (ctrl.Result, error) { + logger := log.FromContext(ctx).WithValues("cdk8sappproxy", types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}, "reconcile_type", "delete") + logger.Info("Starting reconcileDelete") + + proxyNamespacedName := types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} + + // Stop any active git poller + r.stopGitPoller(proxyNamespacedName, logger) + + if !controllerutil.ContainsFinalizer(cdk8sAppProxy, Finalizer) { + logger.Info("Finalizer already removed, nothing to do.") + + return ctrl.Result{}, nil + } + + // Get a source path for deletion + appSourcePath, cleanup, err := r.prepareSourceForDeletion(ctx, cdk8sAppProxy, logger) + if err != nil { + return ctrl.Result{}, err + } + defer cleanup() + + // Get resources to delete + parsedResources, err := r.synthesizeAndParseResources(appSourcePath, logger) + if err != nil { + return ctrl.Result{}, err + } + + // Delete resources from target clusters + if err := r.deleteResourcesFromClusters(ctx, cdk8sAppProxy, parsedResources, logger); err != nil { + return ctrl.Result{}, err + } + + // Clean up watches and remove finalizer + return r.finalizeDeletion(ctx, cdk8sAppProxy, proxyNamespacedName, logger) +} + +func (r *Reconciler) reconcileNormal(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy) (ctrl.Result, error) { + logger := log.FromContext(ctx).WithValues("cdk8sappproxy", types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}, "reconcile_type", "normal") + logger.Info("Starting reconcileNormal") + + proxyNamespacedName := types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} + + // Handle deletion trigger annotation + forceSynthAndApplyDueToDeletion, err := r.handleDeletionTriggerAnnotation(ctx, cdk8sAppProxy, logger) + if err != nil { + return ctrl.Result{}, err + } + + // Initialize active watches for this proxy + r.initializeActiveWatches(proxyNamespacedName) + + // Add finalizer if needed + if shouldRequeue, err := r.ensureFinalizer(ctx, cdk8sAppProxy, logger); err != nil || shouldRequeue { + return ctrl.Result{Requeue: shouldRequeue}, err + } + + // Prepare a source path and get current commit hash + appSourcePath, currentCommitHash, cleanup, err := r.prepareSource(ctx, cdk8sAppProxy, proxyNamespacedName, logger) + if err != nil { + return ctrl.Result{}, err + } + defer cleanup() + + // Manage git poller lifecycle + r.manageGitPollerLifecycle(ctx, cdk8sAppProxy, proxyNamespacedName, logger) + + // Synthesize and parse resources + parsedResources, err := r.synthesizeAndParseResources(appSourcePath, logger) + if err != nil { + return ctrl.Result{}, err + } + + if len(parsedResources) == 0 { + if err := r.handleNoResources(ctx, cdk8sAppProxy, logger); err != nil { + return ctrl.Result{}, err + } + + return ctrl.Result{}, nil + } + + // Determine if apply is needed + applyNeeded, clusterList, err := r.determineIfApplyNeeded(ctx, cdk8sAppProxy, parsedResources, currentCommitHash, forceSynthAndApplyDueToDeletion, logger) + if err != nil { + return ctrl.Result{}, err + } + + if !applyNeeded { + if err := r.handleSkipApply(ctx, cdk8sAppProxy, currentCommitHash, logger); err != nil { + return ctrl.Result{}, err + } + + return ctrl.Result{}, nil + } + + // Apply resources to clusters + return r.applyResourcesToClusters(ctx, cdk8sAppProxy, parsedResources, clusterList, currentCommitHash, proxyNamespacedName, logger) +} + +func (r *Reconciler) handleDeletionTriggerAnnotation(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, logger logr.Logger) (bool, error) { + deletionTriggerAnnotationKey := "cdk8s.addons.cluster.x-k8s.io/reconcile-on-delete-trigger" + forceSynthAndApplyDueToDeletion := false + + if cdk8sAppProxy.Annotations != nil { + if _, ok := cdk8sAppProxy.Annotations[deletionTriggerAnnotationKey]; ok { + forceSynthAndApplyDueToDeletion = true + logger.Info("Reconciliation was triggered by a resource deletion annotation.", "annotationKey", deletionTriggerAnnotationKey) + + // Clear the annotation + logger.Info("Attempting to clear the resource deletion trigger annotation.", "annotationKey", deletionTriggerAnnotationKey) + delete(cdk8sAppProxy.Annotations, deletionTriggerAnnotationKey) + if len(cdk8sAppProxy.Annotations) == 0 { + cdk8sAppProxy.Annotations = nil + } + + if err := r.Update(ctx, cdk8sAppProxy); err != nil { + logger.Error(err, "Failed to clear the resource deletion trigger annotation. Requeuing.", "annotationKey", deletionTriggerAnnotationKey) + + return false, err + } + logger.Info("Successfully cleared the resource deletion trigger annotation.", "annotationKey", deletionTriggerAnnotationKey) + } + } + + return forceSynthAndApplyDueToDeletion, nil +} + +func (r *Reconciler) initializeActiveWatches(proxyNamespacedName types.NamespacedName) { + if r.ActiveWatches[proxyNamespacedName] == nil { + r.ActiveWatches[proxyNamespacedName] = make(map[string]context.CancelFunc) + } +} + +func (r *Reconciler) ensureFinalizer(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, logger logr.Logger) (bool, error) { + if !controllerutil.ContainsFinalizer(cdk8sAppProxy, Finalizer) { + logger.Info("Adding finalizer", "finalizer", Finalizer) + controllerutil.AddFinalizer(cdk8sAppProxy, Finalizer) + if err := r.Update(ctx, cdk8sAppProxy); err != nil { + logger.Error(err, "Failed to add finalizer") + + return false, err + } + logger.Info("Successfully added finalizer") + + return true, nil + } + + return false, nil +} + +func (r *Reconciler) prepareSource(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, proxyNamespacedName types.NamespacedName, logger logr.Logger) (string, string, func(), error) { + var appSourcePath string + var currentCommitHash string + var cleanupFunc func() + + switch { + case cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "": + path, hash, cleanup, err := r.prepareGitSource(ctx, cdk8sAppProxy, logger) + if err != nil { + return "", "", nil, err + } + appSourcePath = path + currentCommitHash = hash + cleanupFunc = cleanup + + // Store current commit hash in status + if currentCommitHash != "" { + cdk8sAppProxy.Status.LastRemoteGitHash = currentCommitHash + logger.Info("Updated cdk8sAppProxy.Status.LastRemoteGitHash with the latest commit hash from remote", "lastRemoteGitHash", currentCommitHash) + } + + case cdk8sAppProxy.Spec.LocalPath != "": + logger.Info("Determined source type: LocalPath", "path", cdk8sAppProxy.Spec.LocalPath) + appSourcePath = cdk8sAppProxy.Spec.LocalPath + cleanupFunc = func() {} + + // Stop any existing git poller for a local path + if cancel, ok := r.activeGitPollers[proxyNamespacedName]; ok { + logger.Info("GitRepository spec removed or empty, stopping existing git poller.") + cancel() + delete(r.activeGitPollers, proxyNamespacedName) + } + + default: + err := errors.New("no source specified") + logger.Error(err, "No source specified (neither GitRepository nor LocalPath)") + if cancel, ok := r.activeGitPollers[proxyNamespacedName]; ok { + logger.Info("Source spec is invalid or removed, stopping existing git poller.") + cancel() + delete(r.activeGitPollers, proxyNamespacedName) + } + // Use the new consolidated error handler - removeFinalizer = false for normal operations + _ = r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.SourceNotSpecifiedReason, "Neither GitRepository nor LocalPath specified", err, false) + + return "", "", nil, err + } + + return appSourcePath, currentCommitHash, cleanupFunc, nil +} + +func (r *Reconciler) prepareGitSource(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, logger logr.Logger) (string, string, func(), error) { + gitSpec := cdk8sAppProxy.Spec.GitRepository + logger.Info("Determined source type: GitRepository", "url", gitSpec.URL, "reference", gitSpec.Reference, "path", gitSpec.Path) + + tempDir, err := os.MkdirTemp("", "cdk8s-git-clone-") + if err != nil { + logger.Error(err, "Failed to create temp directory for git clone") + _ = r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCloneFailedReason, "Failed to create temp dir for git clone", err, false) + + return "", "", nil, err + } + + cleanupFunc := func() { + logger.Info("Removing temporary clone directory", "tempDir", tempDir) + if err := os.RemoveAll(tempDir); err != nil { + logger.Error(err, "Failed to remove temporary clone directory", "tempDir", tempDir) + } + } + + logger.Info("Created temporary directory for clone", "tempDir", tempDir) + + // Clone repository + if err := r.cloneGitRepository(ctx, cdk8sAppProxy, gitSpec, tempDir, logger, OperationNormal); err != nil { + cleanupFunc() + + return "", "", nil, err + } + + // Checkout-specific reference if specified + if err := r.checkoutGitReference(ctx, cdk8sAppProxy, gitSpec, tempDir, logger, OperationNormal); err != nil { + cleanupFunc() + + return "", "", nil, err + } + + // Determine a final app source path + appSourcePath := tempDir + if gitSpec.Path != "" { + appSourcePath = filepath.Join(tempDir, gitSpec.Path) + logger.Info("Adjusted appSourcePath for repository subpath", "subPath", gitSpec.Path, "finalPath", appSourcePath) + } + + // Get current commit hash + currentCommitHash, err := r.getCurrentCommitHash(tempDir, logger) + if err != nil { + cleanupFunc() + + return "", "", nil, r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCloneFailedReason, "Failed to get commit hash: "+err.Error(), err, false) + } + + return appSourcePath, currentCommitHash, cleanupFunc, nil +} + +func (r *Reconciler) checkoutGitReference(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, gitSpec *addonsv1alpha1.GitRepositorySpec, tempDir string, logger logr.Logger, operation string) error { + if gitSpec.Reference == "" { + return nil + } + logger.Info("Executing git checkout with go-git", "reference", gitSpec.Reference, "dir", tempDir, "operation", operation) + + repo, err := git.PlainOpen(tempDir) + if err != nil { + logger.Error(err, "go-git PlainOpen failed", "operation", operation) + if cdk8sAppProxy != nil { + removeFinalizer := operation == OperationDeletion + + return r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCheckoutFailedReason, "go-git PlainOpen failed during "+operation, err, removeFinalizer) + } + + return err + } + + worktree, err := repo.Worktree() + if err != nil { + logger.Error(err, "go-git Worktree failed", "operation", operation) + if cdk8sAppProxy != nil { + removeFinalizer := operation == OperationDeletion + + return r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCheckoutFailedReason, "go-git Worktree failed during "+operation, err, removeFinalizer) + } + + return err + } + + checkoutOpts := &git.CheckoutOptions{Force: true} + if plumbing.IsHash(gitSpec.Reference) { + checkoutOpts.Hash = plumbing.NewHash(gitSpec.Reference) + } else { + revision := plumbing.Revision(gitSpec.Reference) + resolvedHash, err := repo.ResolveRevision(revision) + if err != nil { + logger.Error(err, "go-git ResolveRevision failed", "reference", gitSpec.Reference, "operation", operation) + if cdk8sAppProxy != nil { + removeFinalizer := operation == OperationDeletion + + return r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCheckoutFailedReason, "go-git ResolveRevision failed for ref "+gitSpec.Reference+" during "+operation, err, removeFinalizer) + } + + return err + } + checkoutOpts.Hash = *resolvedHash + } + + err = worktree.Checkout(checkoutOpts) + if err != nil { + logger.Error(err, "go-git Checkout failed", "reference", gitSpec.Reference, "operation", operation) + if cdk8sAppProxy != nil { + removeFinalizer := operation == OperationDeletion + + return r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCheckoutFailedReason, "go-git Checkout failed for ref "+gitSpec.Reference+" during "+operation, err, removeFinalizer) + } + + return err + } + logger.Info("Successfully checked out git reference with go-git", "reference", gitSpec.Reference, "operation", operation) + + return nil +} + +func (r *Reconciler) getCurrentCommitHash(tempDir string, logger logr.Logger) (string, error) { + logger.Info("Attempting to retrieve current commit hash from Git repository", "repoDir", tempDir) + repo, err := git.PlainOpen(tempDir) + if err != nil { + logger.Error(err, "Failed to open git repository after clone/checkout") + + return "", err + } + + headRef, err := repo.Head() + if err != nil { + logger.Error(err, "Failed to get HEAD reference from git repository") + + return "", err + } + + commitHash := headRef.Hash().String() + logger.Info("Successfully retrieved current commit hash from Git repository", "commitHash", commitHash) + + return commitHash, nil +} + +func (r *Reconciler) handleNoResources(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, logger logr.Logger) error { + logger.Info("No valid Kubernetes resources parsed from manifest files") + conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, addonsv1alpha1.NoResourcesParsedReason, clusterv1.ConditionSeverityWarning, "No valid Kubernetes resources found in manifests") + if err := r.Status().Update(ctx, cdk8sAppProxy); err != nil { + logger.Error(err, "Failed to update status after no resources parsed") + + return err + } + + return nil +} + +func (r *Reconciler) determineIfApplyNeeded(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, parsedResources []*unstructured.Unstructured, currentCommitHash string, forceSynthAndApplyDueToDeletion bool, logger logr.Logger) (bool, clusterv1.ClusterList, error) { + var clusterList clusterv1.ClusterList + + // Check for git or annotation triggers + triggeredByGitOrAnnotation := r.checkGitOrAnnotationTriggers(cdk8sAppProxy, currentCommitHash, forceSynthAndApplyDueToDeletion, logger) + + if !triggeredByGitOrAnnotation { + // Check if resources are missing on clusters + foundMissingResources, list, err := r.verifyResourcesOnClusters(ctx, cdk8sAppProxy, parsedResources, logger) + if err != nil { + return false, clusterList, err + } + clusterList = list + + return foundMissingResources, clusterList, nil + } + + return true, clusterList, nil +} + +func (r *Reconciler) verifyResourcesOnClusters(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, parsedResources []*unstructured.Unstructured, logger logr.Logger) (bool, clusterv1.ClusterList, error) { + var clusterList clusterv1.ClusterList + foundMissingResourcesOnAnyCluster := false + + if len(parsedResources) == 0 { + logger.Info("No parsed resources to verify. Skipping resource verification.") + + return false, clusterList, nil + } + + selector, err := metav1.LabelSelectorAsSelector(&cdk8sAppProxy.Spec.ClusterSelector) + if err != nil { + logger.Error(err, "Failed to parse ClusterSelector for verification, assuming resources might be missing.", "selector", cdk8sAppProxy.Spec.ClusterSelector) + + return true, clusterList, r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.ClusterSelectorParseFailedReason, "Failed to parse ClusterSelector for verification", err, false) + } + + logger.Info("Listing clusters for resource verification", "selector", selector.String(), "namespace", cdk8sAppProxy.Namespace) + if err := r.List(ctx, &clusterList, client.MatchingLabelsSelector{Selector: selector}); err != nil { + logger.Error(err, "Failed to list clusters for verification, assuming resources might be missing.") + + return true, clusterList, r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.ListClustersFailedReason, "Failed to list clusters for verification", err, false) + } + + if len(clusterList.Items) == 0 { + logger.Info("No clusters found matching selector for verification. Skipping resource verification on clusters.") + + return false, clusterList, nil + } + + logger.Info("Successfully listed clusters for verification", "count", len(clusterList.Items)) + for _, cluster := range clusterList.Items { + clusterLogger := logger.WithValues("targetCluster", cluster.Name) + clusterLogger.Info("Verifying resources on cluster") + dynamicClient, err := r.getDynamicClientForCluster(ctx, cluster.Namespace, cluster.Name) + if err != nil { + clusterLogger.Error(err, "Failed to get dynamic client for verification. Assuming resources missing on this cluster.") + foundMissingResourcesOnAnyCluster = true + + break + } + for _, resource := range parsedResources { + gvr := resource.GroupVersionKind().GroupVersion().WithResource(getPluralFromKind(resource.GetKind())) + exists, checkErr := checkIfResourceExists(ctx, dynamicClient, gvr, resource.GetNamespace(), resource.GetName()) + if checkErr != nil { + clusterLogger.Error(checkErr, "Error checking resource existence. Assuming resource missing.", "resourceName", resource.GetName(), "GVK", gvr) + foundMissingResourcesOnAnyCluster = true + + break + } + if !exists { + clusterLogger.Info("Resource missing on target cluster.", "resourceName", resource.GetName(), "GVK", gvr, "namespace", resource.GetNamespace()) + foundMissingResourcesOnAnyCluster = true + + break + } + } + if foundMissingResourcesOnAnyCluster { + break + } + } + + return foundMissingResourcesOnAnyCluster, clusterList, nil +} + +func (r *Reconciler) checkGitOrAnnotationTriggers(cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, currentCommitHash string, forceSynthAndApplyDueToDeletion bool, logger logr.Logger) bool { + // Check for periodic git poller trigger + if cdk8sAppProxy.Status.LastRemoteGitHash != "" && + cdk8sAppProxy.Status.LastRemoteGitHash != cdk8sAppProxy.Status.LastProcessedGitHash && + cdk8sAppProxy.Status.LastRemoteGitHash != currentCommitHash { + logger.Info("Reconciliation proceeding due to change detected by git poller.", + "lastRemoteGitHash", cdk8sAppProxy.Status.LastRemoteGitHash, + "lastProcessedGitHash", cdk8sAppProxy.Status.LastProcessedGitHash, + "currentCommitHash", currentCommitHash) + + return true + } + + // Check for git repository changes + if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" { + if currentCommitHash == "" { + logger.Info("currentCommitHash is unexpectedly empty for Git source; proceeding with update as a precaution.") + + return true + } + + lastProcessedGitHash := cdk8sAppProxy.Status.LastProcessedGitHash + gitSpecRef := cdk8sAppProxy.Spec.GitRepository.Reference + repositoryHasChanged := currentCommitHash != lastProcessedGitHash + isInitialDeployment := lastProcessedGitHash == "" + + if isInitialDeployment { + logger.Info("Initial deployment or no last processed hash found. Proceeding with cdk8s synth and apply.", "currentCommitHash", currentCommitHash, "reference", gitSpecRef) + + return true + } + if repositoryHasChanged { + logger.Info("Git repository has changed (current clone vs last processed), proceeding with update.", "currentCommitHash", currentCommitHash, "lastProcessedGitHash", lastProcessedGitHash, "reference", gitSpecRef) + + return true + } + logger.Info("No new Git changes detected (current clone matches last processed, and no pending poller detection).", "commitHash", currentCommitHash, "reference", gitSpecRef) + } else if cdk8sAppProxy.Spec.LocalPath != "" && cdk8sAppProxy.Status.ObservedGeneration == 0 { + logger.Info("Initial processing for LocalPath or source type without explicit change detection. Proceeding with cdk8s synth and apply.") + + return true + } + + // Check for deletion trigger + if forceSynthAndApplyDueToDeletion { + logger.Info("Forcing synth and apply because reconciliation was triggered by a resource deletion") + + return true + } + + return false +} + +func (r *Reconciler) handleSkipApply(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, currentCommitHash string, logger logr.Logger) error { + logger.Info("Skipping resource application: no Git changes, no deletion annotation, and all resources verified present.") + + // Re-establish watches for existing resources after controller restart + if err := r.reestablishWatchesForExistingResources(ctx, cdk8sAppProxy, logger); err != nil { + logger.Error(err, "Failed to re-establish watches for existing resources") + } + + cdk8sAppProxy.Status.ObservedGeneration = cdk8sAppProxy.Generation + conditions.MarkTrue(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition) + + if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" && currentCommitHash != "" { + cdk8sAppProxy.Status.LastProcessedGitHash = currentCommitHash + logger.Info("Updated LastProcessedGitHash to current commit hash as no changes or missing resources were found.", "hash", currentCommitHash) + } + + if err := r.Status().Update(ctx, cdk8sAppProxy); err != nil { + logger.Error(err, "Failed to update status after skipping resource application.") + + return err + } + + return nil +} + +func (r *Reconciler) reestablishWatchesForExistingResources(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, logger logr.Logger) error { + // Get the source and parse resources to know what should be watched + appSourcePath, _, cleanup, err := r.prepareSource(ctx, cdk8sAppProxy, types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}, logger) + if err != nil { + return err + } + defer cleanup() + + parsedResources, err := r.synthesizeAndParseResources(appSourcePath, logger) + if err != nil { + return err + } + + // Get target clusters + selector, err := metav1.LabelSelectorAsSelector(&cdk8sAppProxy.Spec.ClusterSelector) + if err != nil { + return err + } + + var clusterList clusterv1.ClusterList + if err := r.List(ctx, &clusterList, client.MatchingLabelsSelector{Selector: selector}); err != nil { + return err + } + + proxyNamespacedName := types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} + + // Re-establish watches for each resource on each cluster + for _, cluster := range clusterList.Items { + dynamicClient, err := r.getDynamicClientForCluster(ctx, cluster.Namespace, cluster.Name) + if err != nil { + logger.Error(err, "Failed to get dynamic client for watch re-establishment", "cluster", cluster.Name) + + continue + } + + for _, resource := range parsedResources { + gvk := resource.GroupVersionKind() + watchKey := string(cluster.GetUID()) + "/" + resource.GetNamespace() + "/" + resource.GetName() + "/" + gvk.String() + + // Check if watch already exists using ActiveWatches map + if r.ActiveWatches != nil && r.ActiveWatches[proxyNamespacedName] != nil { + if _, exists := r.ActiveWatches[proxyNamespacedName][watchKey]; exists { + logger.Info("Watch already exists, skipping re-establishment", "watchKey", watchKey, "cluster", cluster.Name) + + continue + } + } + + // Start the watch since it doesn't exist + if err := r.startResourceWatch(ctx, dynamicClient, gvk, resource.GetNamespace(), resource.GetName(), proxyNamespacedName, watchKey); err != nil { + logger.Error(err, "Failed to re-establish watch", "watchKey", watchKey, "cluster", cluster.Name) + } else { + logger.Info("Re-established watch for existing resource", "watchKey", watchKey, "cluster", cluster.Name) + } + } + } + + return nil +} + +//nolint:unparam // ctrl.Result is required for controller-runtime reconciler pattern +func (r *Reconciler) applyResourcesToClusters(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, parsedResources []*unstructured.Unstructured, clusterList clusterv1.ClusterList, currentCommitHash string, proxyNamespacedName types.NamespacedName, logger logr.Logger) (ctrl.Result, error) { + logger.Info("Proceeding with application of resources to target clusters.") + + // Ensure clusterList is populated if needed + if len(clusterList.Items) == 0 && len(parsedResources) > 0 { + logger.Info("Cluster list for apply phase is empty, re-listing.") + selector, err := metav1.LabelSelectorAsSelector(&cdk8sAppProxy.Spec.ClusterSelector) + if err != nil { + logger.Error(err, "Failed to parse ClusterSelector for application phase", "selector", cdk8sAppProxy.Spec.ClusterSelector) + + return ctrl.Result{}, r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.ClusterSelectorParseFailedReason, "Failed to parse ClusterSelector for application", err, false) + } + logger.Info("Listing clusters for application phase", "selector", selector.String(), "namespace", cdk8sAppProxy.Namespace) + if err := r.List(ctx, &clusterList, client.MatchingLabelsSelector{Selector: selector}); err != nil { + logger.Error(err, "Failed to list clusters for application phase") + + return ctrl.Result{}, r.updateStatusWithError(ctx, cdk8sAppProxy, addonsv1alpha1.ListClustersFailedReason, "Failed to list clusters for application", err, false) + } + if len(clusterList.Items) == 0 { + logger.Info("No clusters found matching the selector for application phase.") + conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, addonsv1alpha1.NoMatchingClustersReason, clusterv1.ConditionSeverityInfo, "No clusters found matching selector for application") + if errStatusUpdate := r.Status().Update(ctx, cdk8sAppProxy); errStatusUpdate != nil { + logger.Error(errStatusUpdate, "Failed to update status when no matching clusters found for application") + } + + return ctrl.Result{}, nil + } + logger.Info("Successfully listed clusters for application phase", "count", len(clusterList.Items)) + } else if len(parsedResources) == 0 { + logger.Info("No parsed resources to apply, skipping application to clusters.") + cdk8sAppProxy.Status.ObservedGeneration = cdk8sAppProxy.Generation + conditions.MarkTrue(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition) + if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" && currentCommitHash != "" { + cdk8sAppProxy.Status.LastProcessedGitHash = currentCommitHash + } + if err := r.Status().Update(ctx, cdk8sAppProxy); err != nil { + logger.Error(err, "Failed to update status when no resources to apply") + + return ctrl.Result{}, err + } + + return ctrl.Result{}, nil + } + + var overallSuccess = true + var firstErrorEncountered error + + for _, cluster := range clusterList.Items { + clusterLogger := logger.WithValues("targetCluster", cluster.Name) + clusterLogger.Info("Processing cluster for resource application") + dynamicClient, err := r.getDynamicClientForCluster(ctx, cluster.Namespace, cluster.Name) + if err != nil { + clusterLogger.Error(err, "Failed to get dynamic client for cluster application") + overallSuccess = false + if firstErrorEncountered == nil { + firstErrorEncountered = err + } + conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, addonsv1alpha1.KubeconfigUnavailableReason, clusterv1.ConditionSeverityError, "Failed to get dynamic client for cluster %s: %v", cluster.Name, err) + + continue + } + clusterLogger.Info("Successfully created dynamic client for cluster application") + for _, resource := range parsedResources { + resourceCopy := resource.DeepCopy() + gvk := resourceCopy.GroupVersionKind() + gvr := gvk.GroupVersion().WithResource(getPluralFromKind(gvk.Kind)) + applyOpts := metav1.ApplyOptions{FieldManager: "cdk8sappproxy-controller", Force: true} + + clusterLogger.Info("Applying resource", "GVK", gvk.String(), "Name", resourceCopy.GetName(), "Namespace", resourceCopy.GetNamespace()) + appliedResource, applyErr := dynamicClient.Resource(gvr).Namespace(resourceCopy.GetNamespace()).Apply(ctx, resourceCopy.GetName(), resourceCopy, applyOpts) + if applyErr != nil { + clusterLogger.Error(applyErr, "Failed to apply resource to cluster", "resourceName", resourceCopy.GetName()) + overallSuccess = false + if firstErrorEncountered == nil { + firstErrorEncountered = applyErr + } + conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, addonsv1alpha1.ResourceApplyFailedReason, clusterv1.ConditionSeverityError, "Failed to apply %s %s to cluster %s: %v", gvk.Kind, resourceCopy.GetName(), cluster.Name, applyErr) + } else { + clusterLogger.Info("Successfully applied resource to cluster", "resourceName", resourceCopy.GetName()) + watchKey := string(cluster.GetUID()) + "/" + resourceCopy.GetNamespace() + "/" + resourceCopy.GetName() + "/" + gvk.String() + + // Stop existing watch if it exists + r.WatchManager.Stop(proxyNamespacedName, watchKey) + + if err := r.startResourceWatch(ctx, dynamicClient, gvk, appliedResource.GetNamespace(), appliedResource.GetName(), proxyNamespacedName, watchKey); err != nil { + clusterLogger.Error(err, "Failed to start watch for applied resource", "watchKey", watchKey) + } else { + clusterLogger.Info("Successfully started watch for applied resource", "watchKey", watchKey) + } + } + } + } + + if !overallSuccess { + logger.Error(firstErrorEncountered, "One or more errors occurred during resource application to clusters") + + return ctrl.Result{}, firstErrorEncountered + } + + // If we reach here, the overallSuccess is true. + if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" { + cdk8sAppProxy.Status.LastProcessedGitHash = currentCommitHash + logger.Info("Successfully updated LastProcessedGitHash in status after application", "hash", currentCommitHash) + } + + cdk8sAppProxy.Status.ObservedGeneration = cdk8sAppProxy.Generation + conditions.MarkTrue(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition) + if err := r.Status().Update(ctx, cdk8sAppProxy); err != nil { + logger.Error(err, "Failed to update status after successful reconciliation and application") + + return ctrl.Result{}, err + } + logger.Info("Successfully reconciled Cdk8sAppProxy and applied/verified resources.") + + return ctrl.Result{}, nil +} + +func (r *Reconciler) triggerReconciliation(ctx context.Context, proxyName types.NamespacedName, logger logr.Logger) error { + proxyToAnnotate := &addonsv1alpha1.Cdk8sAppProxy{} + if err := r.Get(ctx, proxyName, proxyToAnnotate); err != nil { + logger.Error(err, "Failed to get latest Cdk8sAppProxy for annotation update") + + return err + } + + if proxyToAnnotate.Annotations == nil { + proxyToAnnotate.Annotations = make(map[string]string) + } + proxyToAnnotate.Annotations["cdk8s.addons.cluster.x-k8s.io/git-poll-trigger"] = time.Now().Format(time.RFC3339Nano) + + if err := r.Update(ctx, proxyToAnnotate); err != nil { + logger.Error(err, "Failed to update Cdk8sAppProxy annotations to trigger reconciliation") + + return err + } + + logger.Info("Successfully updated annotations to trigger reconciliation.") + + return nil +} diff --git a/controllers/cdk8sappproxy/cdk8sappproxy_resourcewatcher.go b/controllers/cdk8sappproxy/cdk8sappproxy_resourcewatcher.go new file mode 100644 index 0000000..4b9ebe5 --- /dev/null +++ b/controllers/cdk8sappproxy/cdk8sappproxy_resourcewatcher.go @@ -0,0 +1,293 @@ +package cdk8sappproxy + +import ( + "context" + "sync" + "time" + + addonsv1alpha1 "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/api/v1alpha1" + "github.com/go-logr/logr" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/dynamic" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/log" +) + +// ResourceWatcher watches resources on target clusters. +type ResourceWatcher interface { + Watch(ctx context.Context, config WatchConfig) error +} + +// EventHandler handles different types of watch events. +type EventHandler interface { + OnDeleted(ctx context.Context, config WatchConfig) error + OnOther(ctx context.Context, eventType watch.EventType, config WatchConfig) error + OnClosed(ctx context.Context, config WatchConfig) + OnError(ctx context.Context, err error, config WatchConfig) + + SetWatchManager(wm WatchManager) +} + +// WatchManager manages the lifecycle of resource watches. +type WatchManager interface { + Start(ctx context.Context, config WatchConfig) error + Stop(parentProxy types.NamespacedName, watchKey string) + Cleanup(parentProxy types.NamespacedName) +} + +// WatchConfig encapsulates all watch configuration. +type WatchConfig struct { + TargetClient dynamic.Interface + GVK schema.GroupVersionKind + Namespace string + Name string + ParentProxy types.NamespacedName + WatchKey string +} + +// resourceWatcher implements ResourceWatcher. +type resourceWatcher struct { + events EventHandler +} + +// NewResourceWatcher creates a new resource watcher. +func NewResourceWatcher(events EventHandler) ResourceWatcher { + return &resourceWatcher{ + events: events, + } +} + +func (w *resourceWatcher) Watch(ctx context.Context, config WatchConfig) error { + logger := log.FromContext(ctx).WithValues( + "watchKey", config.WatchKey, + "gvk", config.GVK.String(), + "resourceNamespace", config.Namespace, + "resourceName", config.Name, + "parentProxy", config.ParentProxy.String(), + ) + logger.Info("Starting resource watch") + + watcher, err := w.createWatcher(ctx, config) + if err != nil { + w.events.OnError(ctx, err, config) + + return err + } + defer watcher.Stop() + + return w.processEvents(ctx, watcher, config, logger) +} + +func (w *resourceWatcher) createWatcher(ctx context.Context, config WatchConfig) (watch.Interface, error) { + gvr := config.GVK.GroupVersion().WithResource(getPluralFromKind(config.GVK.Kind)) + + return config.TargetClient.Resource(gvr).Namespace(config.Namespace).Watch(ctx, metav1.ListOptions{ + FieldSelector: "metadata.name=" + config.Name, + }) +} + +func (w *resourceWatcher) processEvents(ctx context.Context, watcher watch.Interface, config WatchConfig, logger logr.Logger) error { + for { + select { + case event, ok := <-watcher.ResultChan(): + if !ok { + w.events.OnClosed(ctx, config) + + return nil + } + + logger.Info("Received watch event", "type", event.Type) + + if event.Type == watch.Deleted { + if err := w.events.OnDeleted(ctx, config); err != nil { + logger.Error(err, "Failed to handle deletion") + } + + return nil + } + + if err := w.events.OnOther(ctx, event.Type, config); err != nil { + logger.Error(err, "Failed to handle event", "type", event.Type) + } + + case <-ctx.Done(): + logger.Info("Watch cancelled") + + return ctx.Err() + } + } +} + +// eventHandler implements EventHandler. +type eventHandler struct { + client client.Client + watchManager WatchManager +} + +// NewEventHandler creates a new event handler. +func NewEventHandler(client client.Client, watchManager WatchManager) EventHandler { + return &eventHandler{ + client: client, + watchManager: watchManager, + } +} + +// Add a setter method for the circular dependency. +func (h *eventHandler) SetWatchManager(wm WatchManager) { + h.watchManager = wm +} + +func (h *eventHandler) OnDeleted(ctx context.Context, config WatchConfig) error { + logger := log.FromContext(ctx).WithValues("parentProxy", config.ParentProxy.String()) + logger.Info("Resource deleted, triggering parent reconciliation") + + if err := h.triggerReconciliation(ctx, config.ParentProxy); err != nil { + logger.Error(err, "Failed to trigger reconciliation") + + return err + } + + // Only call Stop if watchManager is set + if h.watchManager != nil { + h.watchManager.Stop(config.ParentProxy, config.WatchKey) + } + + return nil +} + +// ToDo. +func (h *eventHandler) OnOther(ctx context.Context, eventType watch.EventType, config WatchConfig) error { + logger := log.FromContext(ctx) + logger.Info("Received non-deletion event", "type", eventType) + // Continue watching - reconciliation loop handles desired state + return nil +} + +func (h *eventHandler) OnClosed(ctx context.Context, config WatchConfig) { + logger := log.FromContext(ctx) + logger.Info("Watch closed") + + if h.watchManager != nil { + h.watchManager.Stop(config.ParentProxy, config.WatchKey) + } +} + +func (h *eventHandler) OnError(ctx context.Context, err error, config WatchConfig) { + logger := log.FromContext(ctx) + logger.Error(err, "Watch failed") + + if h.watchManager != nil { + h.watchManager.Stop(config.ParentProxy, config.WatchKey) + } +} + +func (h *eventHandler) triggerReconciliation(ctx context.Context, parentProxy types.NamespacedName) error { + proxy := &addonsv1alpha1.Cdk8sAppProxy{} + if err := h.client.Get(ctx, parentProxy, proxy); err != nil { + return err + } + + if proxy.Annotations == nil { + proxy.Annotations = make(map[string]string) + } + + proxy.Annotations["cdk8s.addons.cluster.x-k8s.io/reconcile-trigger"] = metav1.Now().Format(time.RFC3339Nano) + + return h.client.Update(ctx, proxy) +} + +// watchManager implements WatchManager. +type watchManager struct { + mu sync.RWMutex + watches map[types.NamespacedName]map[string]context.CancelFunc + resourceWatcher ResourceWatcher +} + +// NewWatchManager creates a new watch manager. +func NewWatchManager(resourceWatcher ResourceWatcher) WatchManager { + return &watchManager{ + watches: make(map[types.NamespacedName]map[string]context.CancelFunc), + resourceWatcher: resourceWatcher, + } +} + +func (m *watchManager) Start(ctx context.Context, config WatchConfig) error { + m.mu.Lock() + defer m.mu.Unlock() + + logger := log.FromContext(ctx) + + if m.isActive(config.ParentProxy, config.WatchKey) { + logger.Info("Watch already active", "key", config.WatchKey) + + return nil + } + + watchCtx, cancel := context.WithCancel(ctx) + m.store(config.ParentProxy, config.WatchKey, cancel) + + go func() { + defer cancel() + if err := m.resourceWatcher.Watch(watchCtx, config); err != nil { + logger.Error(err, "Watch failed", "key", config.WatchKey) + } + }() + + return nil +} + +func (m *watchManager) Stop(parentProxy types.NamespacedName, watchKey string) { + m.mu.Lock() + defer m.mu.Unlock() + + if m.watches[parentProxy] != nil { + if cancel, ok := m.watches[parentProxy][watchKey]; ok { + cancel() + delete(m.watches[parentProxy], watchKey) + } + } +} + +func (m *watchManager) Cleanup(parentProxy types.NamespacedName) { + m.mu.Lock() + defer m.mu.Unlock() + + if watches, ok := m.watches[parentProxy]; ok { + for _, cancel := range watches { + cancel() + } + delete(m.watches, parentProxy) + } +} + +func (m *watchManager) isActive(parentProxy types.NamespacedName, watchKey string) bool { + if m.watches[parentProxy] == nil { + return false + } + _, exists := m.watches[parentProxy][watchKey] + + return exists +} + +func (m *watchManager) store(parentProxy types.NamespacedName, watchKey string, cancel context.CancelFunc) { + if m.watches[parentProxy] == nil { + m.watches[parentProxy] = make(map[string]context.CancelFunc) + } + m.watches[parentProxy][watchKey] = cancel +} + +func (r *Reconciler) startResourceWatch(ctx context.Context, targetClient dynamic.Interface, gvk schema.GroupVersionKind, namespace, name string, parentProxy types.NamespacedName, watchKey string) error { + config := WatchConfig{ + TargetClient: targetClient, + GVK: gvk, + Namespace: namespace, + Name: name, + ParentProxy: parentProxy, + WatchKey: watchKey, + } + + return r.WatchManager.Start(ctx, config) +} diff --git a/controllers/cdk8sappproxy/cdk8sappproxy_types.go b/controllers/cdk8sappproxy/cdk8sappproxy_types.go new file mode 100644 index 0000000..5576bec --- /dev/null +++ b/controllers/cdk8sappproxy/cdk8sappproxy_types.go @@ -0,0 +1,28 @@ +package cdk8sappproxy + +import ( + "context" + + "github.com/go-logr/logr" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/tools/record" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// gitProgressLogger buffers git progress messages and logs them line by line. +type gitProgressLogger struct { + logger logr.Logger + buffer []byte +} + +// Reconciler reconciles a Cdk8sAppProxy object. +type Reconciler struct { + client.Client + Scheme *runtime.Scheme + Recorder record.EventRecorder + + WatchManager WatchManager + ActiveWatches map[types.NamespacedName]map[string]context.CancelFunc + activeGitPollers map[types.NamespacedName]context.CancelFunc +} diff --git a/controllers/cdk8sappproxy_controller.go b/controllers/cdk8sappproxy_controller.go deleted file mode 100644 index 4808d0e..0000000 --- a/controllers/cdk8sappproxy_controller.go +++ /dev/null @@ -1,1607 +0,0 @@ -/* -Copyright 2023 The Kubernetes 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 controllers - -import ( - "bytes" - "context" - "io/fs" - "os" - "os/exec" - "path/filepath" - "strings" - "time" - - addonsv1alpha1 "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/api/v1alpha1" - "github.com/go-git/go-git/v5" - "github.com/go-git/go-git/v5/config" - "github.com/go-git/go-git/v5/plumbing" - plumbingtransport "github.com/go-git/go-git/v5/plumbing/transport" - "github.com/go-git/go-git/v5/plumbing/transport/http" - "github.com/go-logr/logr" - "github.com/pkg/errors" - k8scorev1 "k8s.io/api/core/v1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - k8syaml "k8s.io/apimachinery/pkg/util/yaml" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/dynamic" - "k8s.io/client-go/tools/clientcmd" - "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - "sigs.k8s.io/cluster-api/util/conditions" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/controller" - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - "sigs.k8s.io/controller-runtime/pkg/handler" - "sigs.k8s.io/controller-runtime/pkg/log" - - "github.com/go-git/go-git/v5/storage/memory" -) - -const gitPollInterval = 1 * time.Minute - -// CommandExecutor defines an interface for running external commands. -type CommandExecutor interface { - CombinedOutput() ([]byte, error) - SetDir(dir string) -} - -// RealCmdRunner is a concrete implementation of CommandExecutor that runs actual commands. -type RealCmdRunner struct { - Name string - Args []string - Dir string - CommanderFunc func(command string, args ...string) ([]byte, error) -} - -func (rcr *RealCmdRunner) SetDir(dir string) { - rcr.Dir = dir -} - -func (rcr *RealCmdRunner) CombinedOutput() ([]byte, error) { - if rcr.CommanderFunc != nil { - return rcr.CommanderFunc(rcr.Name, rcr.Args...) - } - cmd := exec.Command(rcr.Name, rcr.Args...) - if rcr.Dir != "" { - cmd.Dir = rcr.Dir - } - - return cmd.CombinedOutput() -} - -var cmdRunnerFactory = func(name string, args ...string) CommandExecutor { - return &RealCmdRunner{Name: name, Args: args} -} - -// SetCommander allows tests to override the command runner. -func SetCommander(factory func(name string, args ...string) CommandExecutor) { - cmdRunnerFactory = factory -} - -// ResetCommander resets the command runner to the default real implementation. -func ResetCommander() { - cmdRunnerFactory = func(name string, args ...string) CommandExecutor { - return &RealCmdRunner{Name: name, Args: args} - } -} - -// pollGitRepository periodically checks the remote git repository for changes. -func (r *Cdk8sAppProxyReconciler) pollGitRepository(ctx context.Context, proxyName types.NamespacedName) { - logger := log.FromContext(ctx).WithValues("cdk8sappproxy", proxyName.String(), "goroutine", "pollGitRepository") - logger.Info("Starting git repository polling loop") - - ticker := time.NewTicker(gitPollInterval) - defer ticker.Stop() - - for { - select { - case <-ticker.C: - logger.Info("Polling git repository for changes") - - cdk8sAppProxy := &addonsv1alpha1.Cdk8sAppProxy{} - if err := r.Get(ctx, proxyName, cdk8sAppProxy); err != nil { - if apierrors.IsNotFound(err) { - logger.Info("Cdk8sAppProxy resource not found, stopping polling.") - return - } - logger.Error(err, "Failed to get Cdk8sAppProxy for polling") - continue // Try again on the next tick - } - - if cdk8sAppProxy.Spec.GitRepository == nil || cdk8sAppProxy.Spec.GitRepository.URL == "" { - logger.Info("GitRepository not configured for this Cdk8sAppProxy, stopping polling.") - return - } - - gitSpec := cdk8sAppProxy.Spec.GitRepository - repoURL := gitSpec.URL - - // Determine the reference name for LsRemote. - // LsRemote typically expects fully qualified names like "refs/heads/main". - // If a short branch name is given, we prepend "refs/heads/". - // If a tag is given, "refs/tags/". - // If a hash is given, LsRemote might not work as expected for "polling" the tip. - // For now, we'll focus on branches. - refName := plumbing.HEAD - if gitSpec.Reference != "" { - if plumbing.IsHash(gitSpec.Reference) { - logger.Info("Polling a specific commit hash is not actively supported. The poller will check if the remote still has this hash, but it won't detect 'new' commits beyond this specific one. If you want to track a branch, please specify a branch name.", "reference", gitSpec.Reference) - // We could attempt to see if this hash is still a valid ref, but LsRemote is more about discovering refs. - // For now, if it's a hash, we might not get meaningful polling results in terms of "new" commits. - // One option: try to resolve it. If it's a known commit, LsRemote might list it. - // Another option: skip polling for specific commit hashes. - // Let's try to use it directly, LsRemote might find it if it's a known ref on the server. - refName = plumbing.ReferenceName(gitSpec.Reference) // This might not be correct for a raw hash. - // A better approach for a raw hash might be to skip polling or handle it differently. - // For this iteration, we'll log and proceed, understanding it might not be effective for raw hashes. - } else if strings.HasPrefix(gitSpec.Reference, "refs/") { - refName = plumbing.ReferenceName(gitSpec.Reference) - } else if strings.Contains(gitSpec.Reference, "/") { // Heuristic for full ref names not starting with refs/ - refName = plumbing.ReferenceName(gitSpec.Reference) - } else { // Assume short branch or tag name - // This is a simplification. `git symbolic-ref` or similar logic would be more robust - // to distinguish between branches and tags if not fully qualified. - // For now, assume branches are more common for polling. - logger.Info("Assuming Git reference is a branch name, prepending 'refs/heads/' for LsRemote.", "reference", gitSpec.Reference) - refName = plumbing.NewBranchReferenceName(gitSpec.Reference) // e.g., refs/heads/main - } - } - logger.Info("Attempting to LsRemote", "url", repoURL, "refName", refName.String()) - - rem := git.NewRemote(memory.NewStorage(), &config.RemoteConfig{ - URLs: []string{repoURL}, - }) - - auth := &http.BasicAuth{} // Default to empty auth - if gitSpec.AuthSecretRef != nil { - secret := &k8scorev1.Secret{} - secretKey := client.ObjectKey{Namespace: cdk8sAppProxy.Namespace, Name: gitSpec.AuthSecretRef.Name} - if err := r.Get(ctx, secretKey, secret); err != nil { - logger.Error(err, "Failed to get auth secret for LsRemote") - continue - } - username, userOk := secret.Data["username"] - password, passOk := secret.Data["password"] - if !userOk || !passOk { - logger.Error(errors.New("auth secret missing username or password"), "secretName", secretKey.String()) - continue - } - auth.Username = string(username) - auth.Password = string(password) - logger.Info("Using credentials from AuthSecretRef for LsRemote") - } - - refs, err := rem.ListContext(ctx, &git.ListOptions{ - Auth: auth, // Use configured auth - }) - - if err != nil { - logger.Error(err, "Failed to LsRemote from git repository") - if errors.Is(err, plumbingtransport.ErrAuthenticationRequired) || strings.Contains(err.Error(), "authentication required") { - logger.Info("Authentication failed for LsRemote. Please check credentials.") - } - continue - } - - var remoteCommitHash string - foundRef := false - for _, ref := range refs { - if ref.Name() == refName { - remoteCommitHash = ref.Hash().String() - foundRef = true - logger.Info("Found matching reference in LsRemote output", "refName", refName.String(), "remoteCommitHash", remoteCommitHash) - break - } - } - - if !foundRef { - // If HEAD was used and not found, try to find the default branch (e.g. main or master) - // This is a common scenario if `gitSpec.Reference` was empty. - if refName == plumbing.HEAD { - logger.Info("HEAD reference not explicitly found, searching for default branches like main/master.") - defaultBranches := []plumbing.ReferenceName{ - plumbing.NewBranchReferenceName("main"), - plumbing.NewBranchReferenceName("master"), - } - for _, defaultBranchRef := range defaultBranches { - for _, ref := range refs { - if ref.Name() == defaultBranchRef { - remoteCommitHash = ref.Hash().String() - foundRef = true - logger.Info("Found default branch reference", "refName", defaultBranchRef.String(), "remoteCommitHash", remoteCommitHash) - break - } - } - if foundRef { - break - } - } - } - } - - if !foundRef { - logger.Info("Specified reference not found in LsRemote output.", "refName", refName.String()) - // This could happen if the branch/tag does not exist or if `gitSpec.Reference` was a hash not advertised. - // Or if the default HEAD resolution didn't find a common default branch. - continue - } - - if remoteCommitHash == "" { - logger.Info("Remote commit hash is empty after LsRemote, skipping update check.") - continue - } - - // Get the Cdk8sAppProxy resource again to ensure we have the latest version for status update - latestCdk8sAppProxy := &addonsv1alpha1.Cdk8sAppProxy{} - if err := r.Get(ctx, proxyName, latestCdk8sAppProxy); err != nil { - logger.Error(err, "Failed to get latest Cdk8sAppProxy before status update") - continue - } - - if latestCdk8sAppProxy.Status.LastRemoteGitHash != remoteCommitHash { - logger.Info("Detected change in remote git repository", "oldHash", latestCdk8sAppProxy.Status.LastRemoteGitHash, "newHash", remoteCommitHash) - latestCdk8sAppProxy.Status.LastRemoteGitHash = remoteCommitHash - - // Update status first - if err := r.Status().Update(ctx, latestCdk8sAppProxy); err != nil { - logger.Error(err, "Failed to update Cdk8sAppProxy status with new remote hash") - continue // Try again next time - } - logger.Info("Successfully updated status with new remote hash. Now triggering reconciliation.") - - // Re-fetch to ensure we have the version with updated status before updating annotations - proxyToAnnotate := &addonsv1alpha1.Cdk8sAppProxy{} - if err := r.Get(ctx, proxyName, proxyToAnnotate); err != nil { - logger.Error(err, "Failed to get latest Cdk8sAppProxy for annotation update") - continue - } - - // Trigger reconciliation by updating an annotation - if proxyToAnnotate.Annotations == nil { - proxyToAnnotate.Annotations = make(map[string]string) - } - proxyToAnnotate.Annotations["cdk8s.addons.cluster.x-k8s.io/git-poll-trigger"] = time.Now().Format(time.RFC3339Nano) - if err := r.Update(ctx, proxyToAnnotate); err != nil { - logger.Error(err, "Failed to update Cdk8sAppProxy annotations to trigger reconciliation") - // If this fails, the status is updated, but reconciliation might be delayed. - // The main reconcile loop should still pick up the change in LastRemoteGitHash vs LastProcessedGitHash. - } else { - logger.Info("Successfully updated annotations to trigger reconciliation.") - } - } else { - logger.Info("No change detected in remote git repository.", "currentRemoteHash", remoteCommitHash) - } - - case <-ctx.Done(): - logger.Info("Stopping git repository polling loop due to context cancellation.") - return - } - } -} - -const Cdk8sAppProxyFinalizer = "cdk8sappproxy.addons.cluster.x-k8s.io/finalizer" - -// Cdk8sAppProxyReconciler reconciles a Cdk8sAppProxy object. -type Cdk8sAppProxyReconciler struct { - client.Client - Scheme *runtime.Scheme - Recorder record.EventRecorder // Add this line - // Log logr.Logger // Logger is available from context - ActiveWatches map[types.NamespacedName]map[string]context.CancelFunc - activeGitPollers map[types.NamespacedName]context.CancelFunc -} - -// gitProgressLogger buffers git progress messages and logs them line by line. -type gitProgressLogger struct { - logger logr.Logger - buffer []byte -} - -// Write implements the io.Writer interface. -func (gpl *gitProgressLogger) Write(p []byte) (n int, err error) { - gpl.buffer = append(gpl.buffer, p...) - for { - idx := bytes.IndexByte(gpl.buffer, '\n') - if idx == -1 { - // If buffer gets too large without a newline, log it to prevent OOM - if len(gpl.buffer) > 1024 { - gpl.logger.Info(strings.TrimSpace(string(gpl.buffer))) - gpl.buffer = nil // Clear buffer - } - - break - } - line := gpl.buffer[:idx] - gpl.buffer = gpl.buffer[idx+1:] - gpl.logger.Info(strings.TrimSpace(string(line))) // Log each full line - } - - return len(p), nil -} - -// checkIfResourceExists checks if a given resource exists on the target cluster. -// It uses a dynamic client to make the check. -// Parameters: -// - ctx: Context for the request. -// - dynClient: Dynamic Kubernetes client. -// - gvr: GroupVersionResource of the resource to check. -// - namespace: Namespace of the resource. Can be empty for cluster-scoped resources. -// - name: Name of the resource. -// -// Returns: -// - bool: True if the resource exists, false otherwise. -// - error: An error if the check failed for reasons other than NotFound, nil otherwise. -func checkIfResourceExists(ctx context.Context, dynClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string, name string) (bool, error) { - resourceGetter := dynClient.Resource(gvr) - if namespace != "" { - _, err := resourceGetter.Namespace(namespace).Get(ctx, name, metav1.GetOptions{}) - if err != nil { - if apierrors.IsNotFound(err) { - return false, nil // Resource does not exist - } - // Some other error occurred - return false, errors.Wrapf(err, "failed to get namespaced resource %s/%s with GVR %s", namespace, name, gvr.String()) - } - } else { - _, err := resourceGetter.Get(ctx, name, metav1.GetOptions{}) - if err != nil { - if apierrors.IsNotFound(err) { - return false, nil // Resource does not exist - } - // Some other error occurred - return false, errors.Wrapf(err, "failed to get cluster-scoped resource %s with GVR %s", name, gvr.String()) - } - } - return true, nil // Resource exists -} - -//+kubebuilder:rbac:groups=addons.cluster.x-k8s.io,resources=cdk8sappproxies,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=addons.cluster.x-k8s.io,resources=cdk8sappproxies/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=addons.cluster.x-k8s.io,resources=cdk8sappproxies/finalizers,verbs=update -//+kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusters,verbs=get;list;watch -//+kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusters/status,verbs=get;list;watch -//+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch - -func (r *Cdk8sAppProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - logger := log.FromContext(ctx).WithValues("cdk8sappproxy", req.NamespacedName) - logger.Info("Starting Reconcile") - - // Initialize activeGitPollers map if it's nil - if r.activeGitPollers == nil { - r.activeGitPollers = make(map[types.NamespacedName]context.CancelFunc) - } - // Initialize ActiveWatches map if it's nil - // Note: This was moved from reconcileNormal to ensure it's initialized before any delete or normal path. - if r.ActiveWatches == nil { - r.ActiveWatches = make(map[types.NamespacedName]map[string]context.CancelFunc) - } - - cdk8sAppProxy := &addonsv1alpha1.Cdk8sAppProxy{} - if err := r.Get(ctx, req.NamespacedName, cdk8sAppProxy); err != nil { - if apierrors.IsNotFound(err) { - logger.Info("Cdk8sAppProxy resource not found. Ignoring since object must be deleted.") - - return ctrl.Result{}, nil - } - logger.Error(err, "Failed to get Cdk8sAppProxy") - - return ctrl.Result{}, errors.Wrapf(err, "failed to get Cdk8sAppProxy %s/%s", req.Namespace, req.Name) - } - - logger = logger.WithValues("name", cdk8sAppProxy.Name, "namespace", cdk8sAppProxy.Namespace) - logger.Info("Fetched Cdk8sAppProxy", "deletionTimestamp", cdk8sAppProxy.DeletionTimestamp) - - if !cdk8sAppProxy.DeletionTimestamp.IsZero() { - logger.Info("Cdk8sAppProxy is being deleted, reconciling delete.") - - return r.reconcileDelete(ctx, cdk8sAppProxy) - } - logger.Info("Cdk8sAppProxy is not being deleted, reconciling normal.") - - return r.reconcileNormal(ctx, cdk8sAppProxy) -} - -func (r *Cdk8sAppProxyReconciler) reconcileNormal(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy) (ctrl.Result, error) { - logger := log.FromContext(ctx).WithValues("cdk8sappproxy", types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}, "reconcile_type", "normal") - logger.Info("Starting reconcileNormal") - - deletionTriggerAnnotationKey := "cdk8s.addons.cluster.x-k8s.io/reconcile-on-delete-trigger" - forceSynthAndApplyDueToDeletion := false - if cdk8sAppProxy.Annotations != nil { - if _, ok := cdk8sAppProxy.Annotations[deletionTriggerAnnotationKey]; ok { - forceSynthAndApplyDueToDeletion = true - logger.Info("Reconciliation was triggered by a resource deletion annotation.", "annotationKey", deletionTriggerAnnotationKey) - - // Clear the annotation - logger.Info("Attempting to clear the resource deletion trigger annotation.", "annotationKey", deletionTriggerAnnotationKey) - delete(cdk8sAppProxy.Annotations, deletionTriggerAnnotationKey) - if len(cdk8sAppProxy.Annotations) == 0 { - cdk8sAppProxy.Annotations = nil // Explicitly set to nil if empty - } - - if err := r.Update(ctx, cdk8sAppProxy); err != nil { - logger.Error(err, "Failed to clear the resource deletion trigger annotation. Requeuing.", "annotationKey", deletionTriggerAnnotationKey) - return ctrl.Result{}, err // Requeue to retry clearing the annotation - } - logger.Info("Successfully cleared the resource deletion trigger annotation.", "annotationKey", deletionTriggerAnnotationKey) - } - } - var currentCommitHash string - - // Get the NamespacedName for the Cdk8sAppProxy resource - proxyNamespacedName := types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} - - // Ensure ActiveWatches sub-map is initialized for this specific proxy - // This needs to be done after cdk8sAppProxy is fetched and proxyNamespacedName is defined. - if r.ActiveWatches[proxyNamespacedName] == nil { - r.ActiveWatches[proxyNamespacedName] = make(map[string]context.CancelFunc) - } - - if !controllerutil.ContainsFinalizer(cdk8sAppProxy, Cdk8sAppProxyFinalizer) { - logger.Info("Adding finalizer", "finalizer", Cdk8sAppProxyFinalizer) - controllerutil.AddFinalizer(cdk8sAppProxy, Cdk8sAppProxyFinalizer) - if err := r.Update(ctx, cdk8sAppProxy); err != nil { - logger.Error(err, "Failed to add finalizer") - - return ctrl.Result{}, err - } - logger.Info("Successfully added finalizer") - - return ctrl.Result{Requeue: true}, nil - } - - var appSourcePath string - var cleanupFunc func() - defer func() { - if cleanupFunc != nil { - logger.Info("Cleaning up temporary source directory") - cleanupFunc() - } - }() - - if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" { - gitSpec := cdk8sAppProxy.Spec.GitRepository - logger.Info("Determined source type: GitRepository", "url", gitSpec.URL, "reference", gitSpec.Reference, "path", gitSpec.Path) - tempDir, err := os.MkdirTemp("", "cdk8s-git-clone-") - if err != nil { - logger.Error(err, "Failed to create temp directory for git clone") - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCloneFailedReason, "Failed to create temp dir for git clone", err) - - return ctrl.Result{}, err // Or return specific error - } - cleanupFunc = func() { - logger.Info("Removing temporary clone directory", "tempDir", tempDir) - if err := os.RemoveAll(tempDir); err != nil { - logger.Error(err, "Failed to remove temporary clone directory", "tempDir", tempDir) - } - } - logger.Info("Created temporary directory for clone", "tempDir", tempDir) - - cloneOptions := &git.CloneOptions{ - URL: gitSpec.URL, - Progress: &gitProgressLogger{logger: logger.WithName("git-clone")}, - } - - if gitSpec.AuthSecretRef != nil { - logger.Info("AuthSecretRef specified, attempting to fetch secret", "secretName", gitSpec.AuthSecretRef.Name) - authSecret := &k8scorev1.Secret{} - secretKey := client.ObjectKey{Namespace: cdk8sAppProxy.Namespace, Name: gitSpec.AuthSecretRef.Name} - if err := r.Get(ctx, secretKey, authSecret); err != nil { - logger.Error(err, "Failed to get auth secret for git clone") - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.GitAuthSecretInvalidReason, "Failed to get auth secret "+secretKey.String(), err) - - return ctrl.Result{}, err - } - - username, okUser := authSecret.Data["username"] - password, okPass := authSecret.Data["password"] - - if !okUser || !okPass { - err := errors.New("auth secret missing username or password fields") - logger.Error(err, "Invalid auth secret", "secretName", secretKey.String()) - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.GitAuthSecretInvalidReason, err.Error(), err) - - return ctrl.Result{}, err - } - logger.Info("Successfully fetched auth secret and found credentials") - cloneOptions.Auth = &http.BasicAuth{ - Username: string(username), - Password: string(password), - } - } - - logger.Info("Executing git clone with go-git", "url", gitSpec.URL, "targetDir", tempDir) - _, err = git.PlainCloneContext(ctx, tempDir, false, cloneOptions) - if err != nil { - logger.Error(err, "go-git PlainCloneContext failed") - reason := addonsv1alpha1.GitCloneFailedReason - if errors.Is(err, plumbingtransport.ErrAuthenticationRequired) || strings.Contains(err.Error(), "authentication required") { - reason = addonsv1alpha1.GitAuthenticationFailedReason - } - _ = r.handleError(ctx, cdk8sAppProxy, reason, "go-git clone failed", err) - - return ctrl.Result{}, err - } - logger.Info("Successfully cloned git repository with go-git") - - if gitSpec.Reference != "" { - logger.Info("Executing git checkout with go-git", "reference", gitSpec.Reference, "dir", tempDir) - repo, err := git.PlainOpen(tempDir) - if err != nil { - logger.Error(err, "go-git PlainOpen failed") - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCheckoutFailedReason, "go-git PlainOpen failed", err) - - return ctrl.Result{}, err - } - - worktree, err := repo.Worktree() - if err != nil { - logger.Error(err, "go-git Worktree failed") - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCheckoutFailedReason, "go-git Worktree failed", err) - - return ctrl.Result{}, err - } - - checkoutOpts := &git.CheckoutOptions{Force: true} // Equivalent to -f - if plumbing.IsHash(gitSpec.Reference) { - checkoutOpts.Hash = plumbing.NewHash(gitSpec.Reference) - } else { - // Try to resolve as a branch or tag name - // plumbing.ReferenceName needs to be fully qualified, e.g. refs/heads/main or refs/tags/v1.0.0 - // For short names like "main" or "v1.0.0", ResolveRevision is more robust. - revision := plumbing.Revision(gitSpec.Reference) - resolvedHash, err := repo.ResolveRevision(revision) - if err != nil { - logger.Error(err, "go-git ResolveRevision failed", "reference", gitSpec.Reference) - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCheckoutFailedReason, "go-git ResolveRevision failed for ref "+gitSpec.Reference, err) - - return ctrl.Result{}, err - } - checkoutOpts.Hash = *resolvedHash // Checkout the resolved hash - } - - err = worktree.Checkout(checkoutOpts) - if err != nil { - logger.Error(err, "go-git Checkout failed", "reference", gitSpec.Reference) - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCheckoutFailedReason, "go-git Checkout failed for ref "+gitSpec.Reference, err) - - return ctrl.Result{}, err - } - logger.Info("Successfully checked out git reference with go-git", "reference", gitSpec.Reference) - } - appSourcePath = tempDir - if gitSpec.Path != "" { - appSourcePath = filepath.Join(tempDir, gitSpec.Path) - logger.Info("Adjusted appSourcePath for repository subpath", "subPath", gitSpec.Path, "finalPath", appSourcePath) - } - - // Attempt to retrieve current commit hash - logger.Info("Attempting to retrieve current commit hash from Git repository", "repoDir", tempDir) - repo, err := git.PlainOpen(tempDir) - if err != nil { - logger.Error(err, "Failed to open git repository after clone/checkout") - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCloneFailedReason, "Failed to open git repository: "+err.Error(), err) - return ctrl.Result{}, err - } - headRef, err := repo.Head() - if err != nil { - logger.Error(err, "Failed to get HEAD reference from git repository") - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.GitCloneFailedReason, "Failed to get HEAD reference: "+err.Error(), err) - return ctrl.Result{}, err - } - currentCommitHash = headRef.Hash().String() - logger.Info("Successfully retrieved current commit hash from Git repository", "commitHash", currentCommitHash) - - // Store current commit hash in status - if currentCommitHash != "" { - cdk8sAppProxy.Status.LastRemoteGitHash = currentCommitHash - // Note: Status update will happen later in the reconciliation logic - logger.Info("Updated cdk8sAppProxy.Status.LastRemoteGitHash with the latest commit hash from remote", "lastRemoteGitHash", currentCommitHash) - } - - } else if cdk8sAppProxy.Spec.LocalPath != "" { - logger.Info("Determined source type: LocalPath", "path", cdk8sAppProxy.Spec.LocalPath) - appSourcePath = cdk8sAppProxy.Spec.LocalPath - // If GitRepository is not configured, ensure any existing poller for this proxy is stopped. - if cancel, ok := r.activeGitPollers[proxyNamespacedName]; ok { - logger.Info("GitRepository spec removed or empty, stopping existing git poller.") - cancel() - delete(r.activeGitPollers, proxyNamespacedName) - } - } else { - err := errors.New("no source specified") - logger.Error(err, "No source specified (neither GitRepository nor LocalPath)") - // Ensure any existing poller is stopped if the spec becomes invalid - if cancel, ok := r.activeGitPollers[proxyNamespacedName]; ok { - logger.Info("Source spec is invalid or removed, stopping existing git poller.") - cancel() - delete(r.activeGitPollers, proxyNamespacedName) - } - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.SourceNotSpecifiedReason, "Neither GitRepository nor LocalPath specified", err) - - return ctrl.Result{}, err - } - - // Manage Git Poller Lifecycle - if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" { - if _, pollerExists := r.activeGitPollers[proxyNamespacedName]; !pollerExists { - logger.Info("Starting new git poller.") - pollCtx, cancelPoll := context.WithCancel(context.Background()) // Use Background for long-running goroutine - r.activeGitPollers[proxyNamespacedName] = cancelPoll - go r.pollGitRepository(pollCtx, proxyNamespacedName) - } else { - logger.Info("Git poller already active.") - // For now, we don't restart the poller if spec changes, poller will pick up changes. - // A more advanced implementation might compare old and new gitSpec and restart if necessary. - } - } else { - // This case is also handled above when appSourcePath is determined for LocalPath, - // but it's good to have an explicit check here as well. - if cancel, pollerExists := r.activeGitPollers[proxyNamespacedName]; pollerExists { - logger.Info("GitRepository is not configured, ensuring poller is stopped.") - cancel() - delete(r.activeGitPollers, proxyNamespacedName) - } - } - - logger.Info("Synthesizing cdk8s application", "effectiveSourcePath", appSourcePath) - synthCmd := cmdRunnerFactory("cdk8s", "synth") - synthCmd.SetDir(appSourcePath) - output, synthErr := synthCmd.CombinedOutput() - if synthErr != nil { - logger.Error(synthErr, "cdk8s synth failed", "output", string(output)) - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.Cdk8sSynthFailedReason, "cdk8s synth failed. Output: "+string(output), synthErr) - - return ctrl.Result{}, synthErr - } - logger.Info("cdk8s synth successful", "outputSummary", truncateString(string(output), 200)) - logger.V(1).Info("cdk8s synth full output", "output", string(output)) // Log full output at V(1) - - distPath := filepath.Join(appSourcePath, "dist") - logger.Info("Looking for synthesized manifests", "distPath", distPath) - var manifestFiles []string - walkErr := filepath.WalkDir(distPath, func(path string, d fs.DirEntry, err error) error { - if err != nil { - return err - } - if !d.IsDir() && (strings.HasSuffix(d.Name(), ".yaml") || strings.HasSuffix(d.Name(), ".yml")) { - manifestFiles = append(manifestFiles, path) - } - - return nil - }) - if walkErr != nil { - logger.Error(walkErr, "Failed to walk dist directory") - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.WalkDistFailedReason, "Failed to walk dist directory", walkErr) - - return ctrl.Result{}, walkErr - } - if len(manifestFiles) == 0 { - logger.Info("No manifest files found in dist directory") - conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, addonsv1alpha1.NoManifestsFoundReason, clusterv1.ConditionSeverityWarning, "No YAML manifests found in dist directory") - if err := r.Status().Update(ctx, cdk8sAppProxy); err != nil { - logger.Error(err, "Failed to update status after no manifests found") - } - - return ctrl.Result{}, nil // No manifests, so nothing to process or apply - } - logger.Info("Found manifest files", "count", len(manifestFiles), "files", manifestFiles) - - var parsedResources []*unstructured.Unstructured - for _, manifestFile := range manifestFiles { - logger.Info("Processing manifest file", "file", manifestFile) - fileContent, readErr := os.ReadFile(manifestFile) - if readErr != nil { - logger.Error(readErr, "Failed to read manifest file", "file", manifestFile) - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.ReadManifestFailedReason, "Failed to read manifest "+manifestFile, readErr) - - return ctrl.Result{}, readErr - } - yamlDecoder := k8syaml.NewYAMLOrJSONDecoder(bytes.NewReader(fileContent), 100) - for { - var rawObj runtime.RawExtension - if err := yamlDecoder.Decode(&rawObj); err != nil { - if err.Error() == "EOF" { - break - } - logger.Error(err, "Failed to decode YAML from manifest file", "file", manifestFile) - - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.DecodeManifestFailedReason, "Failed to decode YAML from "+manifestFile, err) - - return ctrl.Result{}, err - } - if rawObj.Raw == nil { - continue - } - u := &unstructured.Unstructured{} - if _, _, err := unstructured.UnstructuredJSONScheme.Decode(rawObj.Raw, nil, u); err != nil { - logger.Error(err, "Failed to decode RawExtension to Unstructured", "file", manifestFile) - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.DecodeToUnstructuredFailedReason, "Failed to decode to Unstructured from "+manifestFile, err) - - return ctrl.Result{}, err - } - logger.Info("Parsed resource", "file", manifestFile, "GVK", u.GroupVersionKind().String(), "Name", u.GetName(), "Namespace", u.GetNamespace()) - parsedResources = append(parsedResources, u) - } - } - if len(parsedResources) == 0 { - logger.Info("No valid Kubernetes resources parsed from manifest files") - conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, addonsv1alpha1.NoResourcesParsedReason, clusterv1.ConditionSeverityWarning, "No valid Kubernetes resources found in manifests") - if err := r.Status().Update(ctx, cdk8sAppProxy); err != nil { - logger.Error(err, "Failed to update status after no resources parsed") - } - // If no resources are parsed, it's similar to no manifests found. - // We might want to update status and return. - // Depending on desired behavior, this could be an error or just an empty result. - // For now, let's match the "No manifest files found" behavior. - return ctrl.Result{}, nil - } - logger.Info("Successfully parsed all resources from manifest files", "count", len(parsedResources)) - - // Change Detection Logic - triggeredByGitOrAnnotation := false // Default to false, explicit conditions will set it to true - - // Condition for periodic git poller - if cdk8sAppProxy.Status.LastRemoteGitHash != "" && - cdk8sAppProxy.Status.LastRemoteGitHash != cdk8sAppProxy.Status.LastProcessedGitHash && - cdk8sAppProxy.Status.LastRemoteGitHash != currentCommitHash { // currentCommitHash is from the fresh clone - triggeredByGitOrAnnotation = true - logger.Info("Reconciliation proceeding due to change detected by git poller.", - "lastRemoteGitHash", cdk8sAppProxy.Status.LastRemoteGitHash, - "lastProcessedGitHash", cdk8sAppProxy.Status.LastProcessedGitHash, - "currentCommitHash", currentCommitHash) - } - - if !triggeredByGitOrAnnotation && cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" { - if currentCommitHash == "" { - logger.Info("currentCommitHash is unexpectedly empty for Git source; proceeding with update as a precaution.") - triggeredByGitOrAnnotation = true - } else { - lastProcessedGitHash := cdk8sAppProxy.Status.LastProcessedGitHash - gitSpecRef := cdk8sAppProxy.Spec.GitRepository.Reference // for logging - repositoryHasChanged := currentCommitHash != lastProcessedGitHash - isInitialDeployment := lastProcessedGitHash == "" - - if isInitialDeployment { - logger.Info("Initial deployment or no last processed hash found. Proceeding with cdk8s synth and apply.", "currentCommitHash", currentCommitHash, "reference", gitSpecRef) - triggeredByGitOrAnnotation = true - } else if repositoryHasChanged { - logger.Info("Git repository has changed (current clone vs last processed), proceeding with update.", "currentCommitHash", currentCommitHash, "lastProcessedGitHash", lastProcessedGitHash, "reference", gitSpecRef) - triggeredByGitOrAnnotation = true - } else { - logger.Info("No new Git changes detected (current clone matches last processed, and no pending poller detection).", "commitHash", currentCommitHash, "reference", gitSpecRef) - // triggeredByGitOrAnnotation remains false - } - } - } else if !triggeredByGitOrAnnotation && (cdk8sAppProxy.Spec.LocalPath != "" || (cdk8sAppProxy.Spec.GitRepository == nil || cdk8sAppProxy.Spec.GitRepository.URL == "")) { - if cdk8sAppProxy.Spec.LocalPath != "" && cdk8sAppProxy.Status.ObservedGeneration == 0 { - logger.Info("Initial processing for LocalPath or source type without explicit change detection. Proceeding with cdk8s synth and apply.") - triggeredByGitOrAnnotation = true - } else if cdk8sAppProxy.Spec.LocalPath != "" { - logger.Info("Subsequent reconciliation for LocalPath and no explicit trigger found. Will check resource integrity.") - } - } - - if forceSynthAndApplyDueToDeletion { - if !triggeredByGitOrAnnotation { - logger.Info("Forcing synth and apply because reconciliation was triggered by a resource deletion, overriding previous checks if they suggested no change.", "annotationKey", deletionTriggerAnnotationKey) - } - triggeredByGitOrAnnotation = true - } - - applyNeeded := triggeredByGitOrAnnotation - var clusterListForApply clusterv1.ClusterList // Define clusterListForApply here to potentially reuse if verification lists clusters - - if !applyNeeded { - logger.Info("No primary triggers (Git changes/Annotation) for resource application. Starting resource verification.") - foundMissingResourcesOnAnyCluster := false - if len(parsedResources) == 0 { - logger.Info("No parsed resources to verify. Skipping resource verification.") - } else { - selector, err := metav1.LabelSelectorAsSelector(&cdk8sAppProxy.Spec.ClusterSelector) - if err != nil { - logger.Error(err, "Failed to parse ClusterSelector for verification, assuming resources might be missing.", "selector", cdk8sAppProxy.Spec.ClusterSelector) - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.ClusterSelectorParseFailedReason, "Failed to parse ClusterSelector for verification", err) // Update status - foundMissingResourcesOnAnyCluster = true // Force apply due to error - } else { - logger.Info("Listing clusters for resource verification", "selector", selector.String(), "namespace", cdk8sAppProxy.Namespace) - if err := r.List(ctx, &clusterListForApply, client.MatchingLabelsSelector{Selector: selector}); err != nil { - logger.Error(err, "Failed to list clusters for verification, assuming resources might be missing.") - _ = r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.ListClustersFailedReason, "Failed to list clusters for verification", err) // Update status - foundMissingResourcesOnAnyCluster = true // Force apply due to error - } else if len(clusterListForApply.Items) == 0 { - logger.Info("No clusters found matching selector for verification. Skipping resource verification on clusters.") - } else { - logger.Info("Successfully listed clusters for verification", "count", len(clusterListForApply.Items)) - for _, cluster := range clusterListForApply.Items { - clusterLogger := logger.WithValues("targetCluster", cluster.Name) - clusterLogger.Info("Verifying resources on cluster") - dynamicClient, err := r.getDynamicClientForCluster(ctx, cluster.Namespace, cluster.Name) - if err != nil { - clusterLogger.Error(err, "Failed to get dynamic client for verification. Assuming resources missing on this cluster.") - foundMissingResourcesOnAnyCluster = true - break // Stop checking this cluster, move to forcing apply - } - for _, resource := range parsedResources { - gvr := resource.GroupVersionKind().GroupVersion().WithResource(getPluralFromKind(resource.GetKind())) - exists, checkErr := checkIfResourceExists(ctx, dynamicClient, gvr, resource.GetNamespace(), resource.GetName()) - if checkErr != nil { - clusterLogger.Error(checkErr, "Error checking resource existence. Assuming resource missing.", "resourceName", resource.GetName(), "GVK", gvr) - foundMissingResourcesOnAnyCluster = true - break // Stop checking resources on this cluster - } - if !exists { - clusterLogger.Info("Resource missing on target cluster.", "resourceName", resource.GetName(), "GVK", gvr, "namespace", resource.GetNamespace()) - foundMissingResourcesOnAnyCluster = true - break // Stop checking resources on this cluster - } - } - if foundMissingResourcesOnAnyCluster { - break // Stop checking other clusters - } - } - } - } - } - - if foundMissingResourcesOnAnyCluster { - logger.Info("Resource verification detected missing resources. Forcing application of all resources.") - applyNeeded = true - } else { - logger.Info("Resource verification complete. All declared resources appear to be present on target clusters.") - } - } - - if !applyNeeded { - logger.Info("Skipping resource application: no Git changes, no deletion annotation, and all resources verified present.") - cdk8sAppProxy.Status.ObservedGeneration = cdk8sAppProxy.Generation - conditions.MarkTrue(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition) - if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" && currentCommitHash != "" { - cdk8sAppProxy.Status.LastProcessedGitHash = currentCommitHash - logger.Info("Updated LastProcessedGitHash to current commit hash as no changes or missing resources were found.", "hash", currentCommitHash) - } - if err := r.Status().Update(ctx, cdk8sAppProxy); err != nil { - logger.Error(err, "Failed to update status after skipping resource application.") - return ctrl.Result{}, err - } - return ctrl.Result{}, nil - } - - // If applyNeeded is true: - logger.Info("Proceeding with application of resources to target clusters.") - - // Ensure clusterListForApply is populated if verification didn't run or didn't populate it. - // This check is a bit redundant if verification always populates it on success, - // but good for safety if verification is skipped (e.g., len(parsedResources) == 0) - // or if it failed early before listing clusters. - if len(clusterListForApply.Items) == 0 && len(parsedResources) > 0 { // Only list if there are resources to apply - logger.Info("Cluster list for apply phase is empty or not populated by verification, re-listing.") - selector, err := metav1.LabelSelectorAsSelector(&cdk8sAppProxy.Spec.ClusterSelector) - if err != nil { - logger.Error(err, "Failed to parse ClusterSelector for application phase", "selector", cdk8sAppProxy.Spec.ClusterSelector) - return ctrl.Result{}, r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.ClusterSelectorParseFailedReason, "Failed to parse ClusterSelector for application", err) - } - logger.Info("Listing clusters for application phase", "selector", selector.String(), "namespace", cdk8sAppProxy.Namespace) - if err := r.List(ctx, &clusterListForApply, client.MatchingLabelsSelector{Selector: selector}); err != nil { - logger.Error(err, "Failed to list clusters for application phase") - return ctrl.Result{}, r.handleError(ctx, cdk8sAppProxy, addonsv1alpha1.ListClustersFailedReason, "Failed to list clusters for application", err) - } - if len(clusterListForApply.Items) == 0 { - logger.Info("No clusters found matching the selector for application phase.") - conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, addonsv1alpha1.NoMatchingClustersReason, clusterv1.ConditionSeverityInfo, "No clusters found matching selector for application") - if errStatusUpdate := r.Status().Update(ctx, cdk8sAppProxy); errStatusUpdate != nil { - logger.Error(errStatusUpdate, "Failed to update status when no matching clusters found for application") - } - return ctrl.Result{}, nil // No clusters to apply to - } - logger.Info("Successfully listed clusters for application phase", "count", len(clusterListForApply.Items)) - } else if len(parsedResources) == 0 { - logger.Info("No parsed resources to apply, skipping application to clusters.") - // This case should ideally be caught earlier (e.g. after synth), but as a safeguard: - cdk8sAppProxy.Status.ObservedGeneration = cdk8sAppProxy.Generation - conditions.MarkTrue(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition) // No resources means "applied" - if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" && currentCommitHash != "" { - cdk8sAppProxy.Status.LastProcessedGitHash = currentCommitHash - } - if err := r.Status().Update(ctx, cdk8sAppProxy); err != nil { - logger.Error(err, "Failed to update status when no resources to apply") - return ctrl.Result{}, err - } - return ctrl.Result{}, nil - } - - var overallSuccess = true - var firstErrorEncountered error - - for _, cluster := range clusterListForApply.Items { - clusterLogger := logger.WithValues("targetCluster", cluster.Name) - clusterLogger.Info("Processing cluster for resource application") - dynamicClient, err := r.getDynamicClientForCluster(ctx, cluster.Namespace, cluster.Name) - if err != nil { - clusterLogger.Error(err, "Failed to get dynamic client for cluster application") - overallSuccess = false - if firstErrorEncountered == nil { - firstErrorEncountered = err - } - conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, addonsv1alpha1.KubeconfigUnavailableReason, clusterv1.ConditionSeverityError, "Failed to get dynamic client for cluster %s: %v", cluster.Name, err) - continue - } - clusterLogger.Info("Successfully created dynamic client for cluster application") - for _, resource := range parsedResources { - resourceCopy := resource.DeepCopy() - gvk := resourceCopy.GroupVersionKind() - gvr := gvk.GroupVersion().WithResource(getPluralFromKind(gvk.Kind)) - applyOpts := metav1.ApplyOptions{FieldManager: "cdk8sappproxy-controller", Force: true} - - clusterLogger.Info("Applying resource", "GVK", gvk.String(), "Name", resourceCopy.GetName(), "Namespace", resourceCopy.GetNamespace()) - appliedResource, applyErr := dynamicClient.Resource(gvr).Namespace(resourceCopy.GetNamespace()).Apply(ctx, resourceCopy.GetName(), resourceCopy, applyOpts) - if applyErr != nil { - clusterLogger.Error(applyErr, "Failed to apply resource to cluster", "resourceName", resourceCopy.GetName()) - overallSuccess = false - if firstErrorEncountered == nil { - firstErrorEncountered = applyErr - } - conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, addonsv1alpha1.ResourceApplyFailedReason, clusterv1.ConditionSeverityError, "Failed to apply %s %s to cluster %s: %v", gvk.Kind, resourceCopy.GetName(), cluster.Name, applyErr) - } else { - clusterLogger.Info("Successfully applied resource to cluster", "resourceName", resourceCopy.GetName()) - watchKey := string(cluster.GetUID()) + "/" + resourceCopy.GetNamespace() + "/" + resourceCopy.GetName() + "/" + gvk.String() - if cancel, ok := r.ActiveWatches[proxyNamespacedName][watchKey]; ok { - clusterLogger.Info("Cancelling existing watch for resource", "watchKey", watchKey) - cancel() - delete(r.ActiveWatches[proxyNamespacedName], watchKey) - } - watchCtx, cancelWatch := context.WithCancel(context.Background()) - r.ActiveWatches[proxyNamespacedName][watchKey] = cancelWatch - go r.watchResourceOnTargetCluster( - watchCtx, - dynamicClient, - gvk, - appliedResource.GetNamespace(), - appliedResource.GetName(), - proxyNamespacedName, - watchKey, - ) - } - } - } - - if !overallSuccess { - logger.Error(firstErrorEncountered, "One or more errors occurred during resource application to clusters") - // Status already marked by handleError or within the loop by conditions.MarkFalse - // We might not need to call handleError explicitly here if conditions are set correctly inside. - // However, ensuring the top-level error is returned is important. - return ctrl.Result{}, firstErrorEncountered - } - - // If we reach here, overallSuccess is true. - if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" { - cdk8sAppProxy.Status.LastProcessedGitHash = currentCommitHash - logger.Info("Successfully updated LastProcessedGitHash in status after application", "hash", currentCommitHash) - } - - cdk8sAppProxy.Status.ObservedGeneration = cdk8sAppProxy.Generation - conditions.MarkTrue(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition) - if err := r.Status().Update(ctx, cdk8sAppProxy); err != nil { - logger.Error(err, "Failed to update status after successful reconciliation and application") - return ctrl.Result{}, err - } - logger.Info("Successfully reconciled Cdk8sAppProxy and applied/verified resources.") - return ctrl.Result{}, nil -} - -func (r *Cdk8sAppProxyReconciler) reconcileDelete(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy) (ctrl.Result, error) { - logger := log.FromContext(ctx).WithValues("cdk8sappproxy", types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}, "reconcile_type", "delete") - logger.Info("Starting reconcileDelete") - - proxyNamespacedName := types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} - - // Stop any active git poller for this resource - if cancel, ok := r.activeGitPollers[proxyNamespacedName]; ok { - logger.Info("Stopping git poller due to resource deletion.") - cancel() - delete(r.activeGitPollers, proxyNamespacedName) - } - - if !controllerutil.ContainsFinalizer(cdk8sAppProxy, Cdk8sAppProxyFinalizer) { - logger.Info("Finalizer already removed, nothing to do.") - - return ctrl.Result{}, nil - } - - var appSourcePathForDelete string - var cleanupDeleteFunc func() - defer func() { - if cleanupDeleteFunc != nil { - logger.Info("Cleaning up temporary source directory for deletion") - cleanupDeleteFunc() - } - }() - - if cdk8sAppProxy.Spec.GitRepository != nil && cdk8sAppProxy.Spec.GitRepository.URL != "" { - gitSpec := cdk8sAppProxy.Spec.GitRepository - logger.Info("Using GitRepository source for deletion logic", "url", gitSpec.URL, "reference", gitSpec.Reference, "path", gitSpec.Path) - tempDir, err := os.MkdirTemp("", "cdk8s-git-delete-") - if err != nil { - logger.Error(err, "failed to create temp dir for git clone during deletion") - - return ctrl.Result{}, err - } - cleanupDeleteFunc = func() { - logger.Info("Removing temporary clone directory for deletion", "tempDir", tempDir) - if err := os.RemoveAll(tempDir); err != nil { - logger.Error(err, "Failed to remove temporary clone directory for deletion", "tempDir", tempDir) - } - } - logger.Info("Created temporary directory for clone during deletion", "tempDir", tempDir) - - cloneOptionsDelete := &git.CloneOptions{ - URL: gitSpec.URL, - Progress: &gitProgressLogger{logger: logger.WithName("git-clone-delete")}, - } - - if gitSpec.AuthSecretRef != nil { - logger.Info("AuthSecretRef specified for deletion clone, attempting to fetch secret", "secretName", gitSpec.AuthSecretRef.Name) - authSecret := &k8scorev1.Secret{} - secretKey := client.ObjectKey{Namespace: cdk8sAppProxy.Namespace, Name: gitSpec.AuthSecretRef.Name} - if err := r.Get(ctx, secretKey, authSecret); err != nil { - logger.Error(err, "Failed to get auth secret for git clone during deletion", "secretName", secretKey.String()) - - return ctrl.Result{}, err - } - - username, okUser := authSecret.Data["username"] - password, okPass := authSecret.Data["password"] - - if !okUser || !okPass { - err := errors.New("auth secret missing username or password fields for deletion clone") - logger.Error(err, "Invalid auth secret for deletion clone", "secretName", secretKey.String()) - - return ctrl.Result{}, err - } - logger.Info("Successfully fetched auth secret for deletion clone") - cloneOptionsDelete.Auth = &http.BasicAuth{ - Username: string(username), - Password: string(password), - } - } - - logger.Info("Executing git clone with go-git for deletion", "url", gitSpec.URL, "targetDir", tempDir) - _, err = git.PlainCloneContext(ctx, tempDir, false, cloneOptionsDelete) - if err != nil { - logger.Error(err, "go-git PlainCloneContext failed during deletion") - errMsg := "go-git clone failed during deletion" - reason := addonsv1alpha1.GitCloneFailedReason - if errors.Is(err, plumbingtransport.ErrAuthenticationRequired) || strings.Contains(err.Error(), "authentication required") { - errMsg = "go-git authentication failed during deletion" - reason = addonsv1alpha1.GitAuthenticationFailedReason - } - logger.Error(err, errMsg, "reason", reason) - - return ctrl.Result{}, err - } - logger.Info("Successfully cloned git repository with go-git for deletion") - - if gitSpec.Reference != "" { - logger.Info("Executing git checkout with go-git for deletion", "reference", gitSpec.Reference, "dir", tempDir) - repo, err := git.PlainOpen(tempDir) - if err != nil { - logger.Error(err, "go-git PlainOpen failed during deletion") - - return ctrl.Result{}, err - } - - worktree, err := repo.Worktree() - if err != nil { - logger.Error(err, "go-git Worktree failed during deletion") - - return ctrl.Result{}, err - } - - checkoutOpts := &git.CheckoutOptions{Force: true} // Equivalent to -f - if plumbing.IsHash(gitSpec.Reference) { - checkoutOpts.Hash = plumbing.NewHash(gitSpec.Reference) - } else { - revision := plumbing.Revision(gitSpec.Reference) - resolvedHash, err := repo.ResolveRevision(revision) - if err != nil { - logger.Error(err, "go-git ResolveRevision failed during deletion", "reference", gitSpec.Reference) - - return ctrl.Result{}, err - } - checkoutOpts.Hash = *resolvedHash - } - - err = worktree.Checkout(checkoutOpts) - if err != nil { - logger.Error(err, "go-git Checkout failed during deletion", "reference", gitSpec.Reference) - - return ctrl.Result{}, err - } - logger.Info("Successfully checked out git reference with go-git for deletion", "reference", gitSpec.Reference) - } - appSourcePathForDelete = tempDir - if gitSpec.Path != "" { - appSourcePathForDelete = filepath.Join(tempDir, gitSpec.Path) - logger.Info("Adjusted appSourcePath for deletion", "subPath", gitSpec.Path, "finalPath", appSourcePathForDelete) - } - } else if cdk8sAppProxy.Spec.LocalPath != "" { - logger.Info("Using LocalPath source for deletion logic", "path", cdk8sAppProxy.Spec.LocalPath) - appSourcePathForDelete = cdk8sAppProxy.Spec.LocalPath - } else { - err := errors.New("neither GitRepository nor LocalPath specified, cannot determine resources to delete") - logger.Info(err.Error()) - _ = r.handleDeleteError(ctx, cdk8sAppProxy, err.Error(), nil) - - return ctrl.Result{}, err - } - - logger.Info("Synthesizing cdk8s application to identify resources for deletion", "effectiveSourcePath", appSourcePathForDelete) - synthCmd := cmdRunnerFactory("cdk8s", "synth") - synthCmd.SetDir(appSourcePathForDelete) - output, synthErr := synthCmd.CombinedOutput() - if synthErr != nil { - logger.Error(synthErr, "cdk8s synth failed during deletion", "output", string(output)) - - return ctrl.Result{}, synthErr - } - logger.Info("cdk8s synth successful for deletion", "outputSummary", truncateString(string(output), 200)) - logger.V(1).Info("cdk8s synth full output for deletion", "output", string(output)) - - distPath := filepath.Join(appSourcePathForDelete, "dist") - logger.Info("Looking for manifests for deletion", "distPath", distPath) - var manifestFiles []string - - walkErr := filepath.WalkDir(distPath, func(path string, d fs.DirEntry, err error) error { - if err != nil { - return err - } - if !d.IsDir() && (strings.HasSuffix(d.Name(), ".yaml") || strings.HasSuffix(d.Name(), ".yml")) { - manifestFiles = append(manifestFiles, path) - } - - return nil - }) - if walkErr != nil { - logger.Error(walkErr, "Failed to walk dist directory during deletion") - - return ctrl.Result{}, walkErr - } - logger.Info("Found manifest files for deletion", "count", len(manifestFiles)) - - var parsedResources []*unstructured.Unstructured - for _, manifestFile := range manifestFiles { - logger.Info("Processing manifest file for deletion", "file", manifestFile) - fileContent, readErr := os.ReadFile(manifestFile) - if readErr != nil { - logger.Error(readErr, "Failed to read manifest file during deletion", "file", manifestFile) - - return ctrl.Result{}, readErr - } - yamlDecoder := k8syaml.NewYAMLOrJSONDecoder(bytes.NewReader(fileContent), 100) - for { - var rawObj runtime.RawExtension - if err := yamlDecoder.Decode(&rawObj); err != nil { - if err.Error() == "EOF" { // Check for clean EOF - break - } - logger.Error(err, "Failed to decode YAML from manifest file during deletion", "file", manifestFile) - - return ctrl.Result{}, err // If not EOF, it's a real error - } - if rawObj.Raw == nil { // Should not happen with a successful decode, but good practice - continue - } - u := &unstructured.Unstructured{} - if _, _, err := unstructured.UnstructuredJSONScheme.Decode(rawObj.Raw, nil, u); err != nil { - logger.Error(err, "Failed to decode RawExtension to Unstructured during deletion", "file", manifestFile) - - return ctrl.Result{}, err - } - parsedResources = append(parsedResources, u) - logger.Info("Parsed resource for deletion", "GVK", u.GroupVersionKind().String(), "Name", u.GetName(), "Namespace", u.GetNamespace()) - } - } - logger.Info("Total resources parsed for deletion", "count", len(parsedResources)) - - clusterList := &clusterv1.ClusterList{} - selector, err := metav1.LabelSelectorAsSelector(&cdk8sAppProxy.Spec.ClusterSelector) - if err != nil { - logger.Error(err, "failed to parse ClusterSelector during deletion") - - return ctrl.Result{}, err - } - - logger.Info("Listing clusters for deletion", "selector", selector.String(), "namespace", cdk8sAppProxy.Namespace) - if err := r.List(ctx, clusterList, client.MatchingLabelsSelector{Selector: selector}, client.InNamespace(cdk8sAppProxy.Namespace)); err != nil { - logger.Error(err, "Failed to list clusters during deletion, requeuing") - - return ctrl.Result{}, err // Requeue as we need to process clusters - } - clusterNamesDelete := make([]string, 0, len(clusterList.Items)) - for _, c := range clusterList.Items { - clusterNamesDelete = append(clusterNamesDelete, c.Name) - } - logger.Info("Found clusters for deletion", "count", len(clusterList.Items), "names", clusterNamesDelete) - - for _, cluster := range clusterList.Items { - logger := logger.WithValues("targetCluster", cluster.Name) - logger.Info("Deleting resources from cluster") - dynamicClient, err := r.getDynamicClientForCluster(ctx, cdk8sAppProxy.Namespace, cluster.Name) - if err != nil { - logger.Error(err, "Failed to get dynamic client for cluster during deletion, skipping this cluster") - - continue - } - logger.Info("Successfully created dynamic client for cluster deletion") - for _, resource := range parsedResources { - gvr := resource.GroupVersionKind().GroupVersion().WithResource(getPluralFromKind(resource.GetKind())) - logger.Info("Deleting resource from cluster", "GVK", resource.GroupVersionKind().String(), "Name", resource.GetName(), "Namespace", resource.GetNamespace()) - err := dynamicClient.Resource(gvr).Namespace(resource.GetNamespace()).Delete(ctx, resource.GetName(), metav1.DeleteOptions{}) - if err != nil && !apierrors.IsNotFound(err) { - logger.Error(err, "Failed to delete resource from cluster", "resourceName", resource.GetName()) - } else if apierrors.IsNotFound(err) { - logger.Info("Resource already deleted from cluster", "resourceName", resource.GetName()) - } else { - logger.Info("Successfully deleted resource from cluster", "resourceName", resource.GetName()) - } - } - } - - // Before removing the finalizer, cancel any active watches for this Cdk8sAppProxy. - proxyNamespacedName = types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} - if watchesForProxy, ok := r.ActiveWatches[proxyNamespacedName]; ok { - logger.Info("Cancelling active watches for Cdk8sAppProxy before deletion", "count", len(watchesForProxy)) - for watchKey, cancelFunc := range watchesForProxy { - logger.Info("Cancelling watch", "watchKey", watchKey) - cancelFunc() // Stop the goroutine and its associated Kubernetes watch - } - // After all watches for this proxy are cancelled, remove its entry from the main map. - delete(r.ActiveWatches, proxyNamespacedName) - logger.Info("Removed Cdk8sAppProxy entry from ActiveWatches map") - } else { - logger.Info("No active watches found for this Cdk8sAppProxy to cancel.") - } - - logger.Info("Finished deletion logic, removing finalizer") - controllerutil.RemoveFinalizer(cdk8sAppProxy, Cdk8sAppProxyFinalizer) - if err := r.Update(ctx, cdk8sAppProxy); err != nil { - logger.Error(err, "Failed to remove finalizer") - - return ctrl.Result{}, err - } - logger.Info("Finalizer removed successfully") - - return ctrl.Result{}, nil -} - -func (r *Cdk8sAppProxyReconciler) getDynamicClientForCluster(ctx context.Context, secretNamespace, clusterName string) (dynamic.Interface, error) { - logger := log.FromContext(ctx).WithValues("secretNamespace", secretNamespace, "clusterName", clusterName) - kubeconfigSecretName := clusterName + "-kubeconfig" - logger.Info("Attempting to get Kubeconfig secret", "secretName", kubeconfigSecretName) - kubeconfigSecret := &k8scorev1.Secret{} - if err := r.Get(ctx, client.ObjectKey{Namespace: secretNamespace, Name: kubeconfigSecretName}, kubeconfigSecret); err != nil { - logger.Error(err, "Failed to get Kubeconfig secret") - - return nil, errors.Wrapf(err, "failed to get kubeconfig secret %s/%s", secretNamespace, kubeconfigSecretName) - } - kubeconfigData, ok := kubeconfigSecret.Data["value"] - if !ok || len(kubeconfigData) == 0 { - newErr := errors.Errorf("kubeconfig secret %s/%s does not contain 'value' data", secretNamespace, kubeconfigSecretName) - logger.Error(newErr, "Invalid Kubeconfig secret") - - return nil, newErr - } - logger.Info("Successfully retrieved Kubeconfig data") - restConfig, err := clientcmd.RESTConfigFromKubeConfig(kubeconfigData) - if err != nil { - logger.Error(err, "Failed to create REST config from Kubeconfig") - - return nil, errors.Wrapf(err, "failed to create REST config from kubeconfig for cluster %s", clusterName) - } - logger.Info("Successfully created REST config") - dynamicClient, err := dynamic.NewForConfig(restConfig) - if err != nil { - logger.Error(err, "Failed to create dynamic client") - - return nil, errors.Wrapf(err, "failed to create dynamic client for cluster %s", clusterName) - } - logger.Info("Successfully created dynamic client") - - return dynamicClient, nil -} - -// func (r *Cdk8sAppProxyReconciler) getDynamicClientForCluster(ctx context.Context, proxyNamespace, clusterName string) (dynamic.Interface, error) { -// logger := log.FromContext(ctx).WithValues("proxyNamespace", proxyNamespace, "clusterName", clusterName) -// kubeconfigSecretName := clusterName + "-kubeconfig" -// logger.Info("Attempting to get Kubeconfig secret", "secretName", kubeconfigSecretName) -// kubeconfigSecret := &corev1.Secret{} -// if err := r.Get(ctx, client.ObjectKey{Namespace: proxyNamespace, Name: kubeconfigSecretName}, kubeconfigSecret); err != nil { -// logger.Error(err, "Failed to get Kubeconfig secret") -// return nil, errors.Wrapf(err, "failed to get kubeconfig secret %s/%s", proxyNamespace, kubeconfigSecretName) -// } -// kubeconfigData, ok := kubeconfigSecret.Data["value"] -// if !ok || len(kubeconfigData) == 0 { -// newErr := errors.Errorf("kubeconfig secret %s/%s does not contain 'value' data", proxyNamespace, kubeconfigSecretName) -// logger.Error(newErr, "Invalid Kubeconfig secret") - -// return nil, newErr -// } -// logger.Info("Successfully retrieved Kubeconfig data") -// restConfig, err := clientcmd.RESTConfigFromKubeConfig(kubeconfigData) -// if err != nil { -// logger.Error(err, "Failed to create REST config from Kubeconfig") -// return nil, errors.Wrapf(err, "failed to create REST config from kubeconfig for cluster %s", clusterName) -// } -// logger.Info("Successfully created REST config") -// dynamicClient, err := dynamic.NewForConfig(restConfig) -// if err != nil { -// logger.Error(err, "Failed to create dynamic client") - -// return nil, errors.Wrapf(err, "failed to create dynamic client for cluster %s", clusterName) -// } -// logger.Info("Successfully created dynamic client") - -// return dynamicClient, nil -// } - -// handleError is a helper to consistently update status conditions and log errors. -func (r *Cdk8sAppProxyReconciler) handleError(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, reason, messageFormat string, err error) error { - logger := log.FromContext(ctx).WithValues("cdk8sappproxy", types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}) - logger.Error(err, "Reconciliation error", "reason", reason, "messageFormat", messageFormat) - conditions.MarkFalse(cdk8sAppProxy, addonsv1alpha1.DeploymentProgressingCondition, reason, clusterv1.ConditionSeverityError, messageFormat, err.Error()) // Pass err.Error() for message - if statusUpdateErr := r.Status().Update(ctx, cdk8sAppProxy); statusUpdateErr != nil { - logger.Error(statusUpdateErr, "Failed to update status after error", "originalError", err.Error()) - } - - return err -} - -// handleDeleteError is a helper for reconcileDelete to remove finalizer if non-requeueable error occurs. -func (r *Cdk8sAppProxyReconciler) handleDeleteError(ctx context.Context, cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy, message string, originalErr error) error { - logger := log.FromContext(ctx).WithValues("cdk8sappproxy", types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}) - if originalErr != nil { - logger.Error(originalErr, message+", proceeding to remove finalizer") - } else { - logger.Info(message + ", proceeding to remove finalizer") - } - controllerutil.RemoveFinalizer(cdk8sAppProxy, Cdk8sAppProxyFinalizer) - if err := r.Update(ctx, cdk8sAppProxy); err != nil { - logger.Error(err, "Failed to remove finalizer after error on delete") - - return err - } - logger.Info("Removed finalizer after error/condition on delete") - if originalErr != nil { - return originalErr // Return original error to potentially requeue if it's something transient related to the object update itself - } - - return nil // Successfully handled by removing finalizer -} - -func truncateString(str string, num int) string { - if len(str) > num { - return str[0:num] + "..." - } - - return str -} - -// TODO: This is a naive pluralization and might not work for all kinds. -// A more robust solution would use discovery client or a predefined map. -func getPluralFromKind(kind string) string { - lowerKind := strings.ToLower(kind) - if strings.HasSuffix(lowerKind, "s") { - return lowerKind + "es" - } - if strings.HasSuffix(lowerKind, "y") { - return strings.TrimSuffix(lowerKind, "y") + "ies" - } - - return lowerKind + "s" -} - -// SetupWithManager sets up the controller with the Manager. -func (r *Cdk8sAppProxyReconciler) SetupWithManager(mgr ctrl.Manager, options controller.Options) error { - return ctrl.NewControllerManagedBy(mgr). - For(&addonsv1alpha1.Cdk8sAppProxy{}). - WithOptions(options). // Add this line - Watches( - &clusterv1.Cluster{}, - handler.EnqueueRequestsFromMapFunc(r.ClusterToCdk8sAppProxyMapper), - ). - Complete(r) -} - -// ClusterToCdk8sAppProxyMapper is a handler.ToRequestsFunc to be used to enqeue requests for Cdk8sAppProxyReconciler. -// It maps CAPI Cluster events to Cdk8sAppProxy events. -func (r *Cdk8sAppProxyReconciler) ClusterToCdk8sAppProxyMapper(ctx context.Context, o client.Object) []ctrl.Request { - logger := log.FromContext(ctx) - cluster, ok := o.(*clusterv1.Cluster) - if !ok { - logger.Error(errors.Errorf("unexpected type %T, expected Cluster", o), "failed to cast object to Cluster", "object", o) - - return nil - } - - logger = logger.WithValues("clusterName", cluster.Name, "clusterNamespace", cluster.Namespace) - logger.Info("ClusterToCdk8sAppProxyMapper triggered for cluster") - - proxies := &addonsv1alpha1.Cdk8sAppProxyList{} - // List all Cdk8sAppProxies in the same namespace as the Cluster. - // Adjust if Cdk8sAppProxy can be in a different namespace or cluster-scoped. - // For now, assuming Cdk8sAppProxy is namespace-scoped and in the same namespace as the triggering Cluster's Cdk8sAppProxy object (which is usually the management cluster's default namespace). - // However, Cdk8sAppProxy resources themselves select clusters across namespaces. - // So, we should list Cdk8sAppProxies from all namespaces if the controller has cluster-wide watch permissions for them. - // If the controller is namespace-scoped for Cdk8sAppProxy, this list will be limited. - // For this example, let's assume cluster-wide list for Cdk8sAppProxy. - if err := r.List(ctx, proxies); err != nil { // staticcheck: QF1008 - logger.Error(err, "failed to list Cdk8sAppProxies") - - return nil - } - logger.Info("Checking Cdk8sAppProxies for matches", "count", len(proxies.Items)) - - var requests []ctrl.Request - for _, proxy := range proxies.Items { - proxyLogger := logger.WithValues("cdk8sAppProxyName", proxy.Name, "cdk8sAppProxyNamespace", proxy.Namespace) - proxyLogger.Info("Evaluating Cdk8sAppProxy") - - selector, err := metav1.LabelSelectorAsSelector(&proxy.Spec.ClusterSelector) - if err != nil { - proxyLogger.Error(err, "failed to parse ClusterSelector for Cdk8sAppProxy") - - continue - } - proxyLogger.Info("Parsed ClusterSelector", "selector", selector.String()) - - if selector.Matches(labels.Set(cluster.GetLabels())) { - proxyLogger.Info("Cluster labels match Cdk8sAppProxy selector, enqueuing request") - requests = append(requests, ctrl.Request{ - NamespacedName: client.ObjectKey{ - Namespace: proxy.Namespace, - Name: proxy.Name, - }, - }) - } else { - proxyLogger.Info("Cluster labels do not match Cdk8sAppProxy selector") - } - } - - logger.Info("ClusterToCdk8sAppProxyMapper finished", "requestsEnqueued", len(requests)) - - return requests -} - -func (r *Cdk8sAppProxyReconciler) watchResourceOnTargetCluster( - ctx context.Context, // This context is the one that can be cancelled to stop the watch - targetClient dynamic.Interface, - gvk schema.GroupVersionKind, - namespace string, - name string, - parentProxy types.NamespacedName, - watchKey string, // For logging and map management -) { - logger := log.FromContext(ctx).WithValues( - "watchKey", watchKey, - "gvk", gvk.String(), - "resourceNamespace", namespace, - "resourceName", name, - "parentProxy", parentProxy.String(), - ) - logger.Info("Starting watch for resource on target cluster") - - gvr := gvk.GroupVersion().WithResource(getPluralFromKind(gvk.Kind)) - - watcher, err := targetClient.Resource(gvr).Namespace(namespace).Watch(ctx, metav1.ListOptions{ - FieldSelector: "metadata.name=" + name, - // Watch: true, // Watch is implicit in Watch() method - }) - if err != nil { - logger.Error(err, "Failed to start watch for resource") - // Clean up the watch from the map if it failed to start - if r.ActiveWatches[parentProxy] != nil { - if cancelFn, ok := r.ActiveWatches[parentProxy][watchKey]; ok { - cancelFn() // Call cancel to ensure context is cleaned up if partially initialized - delete(r.ActiveWatches[parentProxy], watchKey) - } - } - return - } - defer watcher.Stop() // Ensure watcher is stopped when goroutine exits - - for { - select { - case event, ok := <-watcher.ResultChan(): - if !ok { - logger.Info("Watch channel closed for resource. Parent controller will re-trigger reconciliation if needed.") - // Remove from activeWatches as this specific watch instance is now defunct. - // The parent reconcile loop will re-establish if the resource still needs to be watched. - if r.ActiveWatches[parentProxy] != nil { - // Check if the current cancel func is still the one we started with, - // though simple deletion is usually fine as reconcileNormal will overwrite. - delete(r.ActiveWatches[parentProxy], watchKey) - } - return // Exit goroutine - } - - logger.Info("Received watch event", "type", event.Type) // Avoid logging event.Object directly in production if it's large - - if event.Type == watch.Deleted { - logger.Info("Resource deletion detected, triggering re-reconciliation of parent proxy", "parentProxy", parentProxy.String()) - - // Create a new context for fetching and updating the parent proxy object. - updateCtx := context.Background() - parentProxyObj := &addonsv1alpha1.Cdk8sAppProxy{} - - // Fetch the Cdk8sAppProxy object. - if err := r.Client.Get(updateCtx, parentProxy, parentProxyObj); err != nil { - logger.Error(err, "Failed to get parent Cdk8sAppProxy for re-reconciliation", "parentProxy", parentProxy.String()) - } else { - // Initialize annotations if nil. - if parentProxyObj.Annotations == nil { - parentProxyObj.Annotations = make(map[string]string) - } - // Set an annotation to trigger reconciliation. - parentProxyObj.Annotations["cdk8s.addons.cluster.x-k8s.io/reconcile-on-delete-trigger"] = metav1.Now().Format(time.RFC3339Nano) - - // Update the Cdk8sAppProxy object. - if err := r.Client.Update(updateCtx, parentProxyObj); err != nil { - logger.Error(err, "Failed to update parent Cdk8sAppProxy for re-reconciliation", "parentProxy", parentProxy.String()) - } else { - logger.Info("Successfully updated parent Cdk8sAppProxy to trigger re-reconciliation", "parentProxy", parentProxy.String()) - } - } - - logger.Info("Resource deleted on target cluster. Cancelling this watch and removing from active watches. Parent Cdk8sAppProxy will re-reconcile.") - // The resource is deleted. This watch is no longer valid. - // Cancel this watch's context (which calls defer watcher.Stop()) - // and remove it from the activeWatches map. - // The main reconcile loop of the parent Cdk8sAppProxy will eventually run - // (due to resync period or other events) and will attempt to re-create - // the resource and a new watch for it. - if r.ActiveWatches[parentProxy] != nil { - if cancelFn, ok := r.ActiveWatches[parentProxy][watchKey]; ok { - cancelFn() // This will cause the ctx.Done() case to be selected if not already. - delete(r.ActiveWatches[parentProxy], watchKey) - } - } - // It's important to return here as this specific watch instance is done. - return - } - // For other events (Added, Modified), we just log and continue watching. - // The main reconciliation loop is responsible for desired state enforcement. - // This watch is primarily to detect deletions and clean up itself. - - case <-ctx.Done(): - logger.Info("Watch context cancelled for resource. Stopping watch.") - // Context was cancelled (likely by reconcileNormal stopping this watch, or reconciler shutting down). - // Remove this watch from the activeWatches map. - if r.ActiveWatches[parentProxy] != nil { - delete(r.ActiveWatches[parentProxy], watchKey) - } - return // Exit goroutine - } - } -} diff --git a/controllers/cdk8sappproxy_controller_test.go b/controllers/cdk8sappproxy_controller_test.go deleted file mode 100644 index 3e55b23..0000000 --- a/controllers/cdk8sappproxy_controller_test.go +++ /dev/null @@ -1,1023 +0,0 @@ -/* -Copyright 2023 The Kubernetes 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 controllers_test - -import ( - "context" - "errors" - "fmt" - "os" - "os/exec" - "path/filepath" - "sync" - - addonsv1alpha1 "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/api/v1alpha1" - "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/controllers" - "github.com/go-git/go-git/v5" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "github.com/stretchr/testify/mock" - corev1 "k8s.io/api/core/v1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/dynamic" - dynamicfake "k8s.io/client-go/dynamic/fake" - kubetesting "k8s.io/client-go/testing" - "sigs.k8s.io/cluster-api/util/conditions" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/client/fake" - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - "sigs.k8s.io/controller-runtime/pkg/log/zap" -) - -// MockCommander is a mock for the command execution part. -type MockCommander struct { - mock.Mock -} - -func (m *MockCommander) CombinedOutput(command string, args ...string) ([]byte, error) { - var MOCK_COMMAND_TYPE string - if command == "git" && len(args) > 0 && args[0] == "clone" { - MOCK_COMMAND_TYPE = "git clone" - } else if command == "git" && len(args) > 0 && args[0] == "checkout" { - MOCK_COMMAND_TYPE = "git checkout" - } else if command == "cdk8s" && len(args) > 0 && args[0] == "synth" { - MOCK_COMMAND_TYPE = "cdk8s synth" - } else { - MOCK_COMMAND_TYPE = command - } - - calledArgs := m.Called(MOCK_COMMAND_TYPE) - output := calledArgs.Get(0) - err := calledArgs.Error(1) - - if output == nil { - return nil, err - } - byteOutput, ok := output.([]byte) - if !ok && output != nil { - return nil, errors.New("mock commander output was not of type []byte") - } - - return byteOutput, err -} - -var _ = Describe("Cdk8sAppProxy controller", func() { - var ( - reconciler *controllers.Cdk8sAppProxyReconciler - mockCommander *MockCommander - testNamespace *corev1.Namespace - ctx context.Context - fakeK8sClient client.Client - fakeScheme *runtime.Scheme - testLog = zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)) - mu sync.Mutex - originalGetDynamicClientFunc func(ctx context.Context, secretNamespace string, clusterName string, proxy client.Client) (dynamic.Interface, error) - ) - - BeforeEach(func() { - ctx = context.Background() - Expect(k8sClient).NotTo(BeNil(), "k8sClient should be initialized in BeforeSuite") - - mockCommander = new(MockCommander) - controllers.SetCommander(func(command string, args ...string) controllers.CommandExecutor { - return &controllers.RealCmdRunner{Name: command, Args: args, CommanderFunc: mockCommander.CombinedOutput} - }) - - reconciler = &controllers.Cdk8sAppProxyReconciler{ - Client: k8sClient, - Scheme: k8sClient.Scheme(), - ActiveWatches: make(map[types.NamespacedName]map[string]context.CancelFunc), - } - - fakeScheme = runtime.NewScheme() - Expect(addonsv1alpha1.AddToScheme(fakeScheme)).To(Succeed()) - Expect(corev1.AddToScheme(fakeScheme)).To(Succeed()) - }) - - AfterEach(func() { - controllers.ResetCommander() - }) - - Context("When reconciling a Cdk8sAppProxy", func() { - var cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy - var key types.NamespacedName - - BeforeEach(func() { - ns := "default" - if testNamespace != nil { - ns = testNamespace.Name - } - - cdk8sAppProxy = &addonsv1alpha1.Cdk8sAppProxy{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-cdk8sappproxy", - Namespace: ns, - }, - Spec: addonsv1alpha1.Cdk8sAppProxySpec{ - ClusterSelector: metav1.LabelSelector{MatchLabels: map[string]string{"env": "test"}}, - }, - } - Expect(k8sClient.Create(ctx, cdk8sAppProxy)).To(Succeed()) - key = types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} - - Eventually(func(g Gomega) { - err := k8sClient.Get(ctx, key, cdk8sAppProxy) - g.Expect(err).NotTo(HaveOccurred()) - if !controllerutil.ContainsFinalizer(cdk8sAppProxy, controllers.Cdk8sAppProxyFinalizer) { - controllerutil.AddFinalizer(cdk8sAppProxy, controllers.Cdk8sAppProxyFinalizer) - err = k8sClient.Update(ctx, cdk8sAppProxy) - g.Expect(err).NotTo(HaveOccurred()) - } - err = k8sClient.Get(ctx, key, cdk8sAppProxy) - g.Expect(err).NotTo(HaveOccurred()) - }, "10s", "100ms").Should(Succeed()) - }) - - AfterEach(func() { - if cdk8sAppProxy != nil && cdk8sAppProxy.UID != "" { - latestProxy := &addonsv1alpha1.Cdk8sAppProxy{} - err := k8sClient.Get(ctx, key, latestProxy) - if err == nil && controllerutil.ContainsFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) { - controllerutil.RemoveFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) - Expect(k8sClient.Update(ctx, latestProxy)).To(Succeed()) - } - Expect(k8sClient.Delete(ctx, cdk8sAppProxy)).To(Succeed()) - Eventually(func() bool { - err := k8sClient.Get(ctx, key, cdk8sAppProxy) - return apierrors.IsNotFound(err) - }, "10s", "100ms").Should(BeTrue()) - } - }) - - It("should reconcile with LocalPath and successful synth", func() { - tempDir, err := os.MkdirTemp("", "local-cdk8s-app-") - Expect(err).NotTo(HaveOccurred()) - defer func() { - if err := os.RemoveAll(tempDir); err != nil { - GinkgoT().Logf("Failed to remove tempDir %s: %v", tempDir, err) - } - }() - - distDir := filepath.Join(tempDir, "dist") - Expect(os.Mkdir(distDir, 0755)).To(Succeed()) - dummyManifest := ` -apiVersion: v1 -kind: ConfigMap -metadata: - name: test-cm -data: - key: value -` - Expect(os.WriteFile(filepath.Join(distDir, "manifest.yaml"), []byte(dummyManifest), 0644)).To(Succeed()) - - cdk8sAppProxy.Spec.LocalPath = tempDir - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - mockCommander.On("CombinedOutput", "cdk8s synth").Return([]byte("synth success output"), nil).Once() - - _, err = reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - - mockCommander.AssertExpectations(GinkgoT()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - }, "10s", "100ms").Should(Succeed()) - }) - - It("should reconcile with GitRepository, clone, and successful synth", func() { - cdk8sAppProxy.Spec.GitRepository = &addonsv1alpha1.GitRepositorySpec{ - URL: "https://github.com/example/repo.git", - } - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - mockCommander.On("CombinedOutput", "cdk8s synth").Return([]byte("synth success"), nil).Once() - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - if err != nil { - GinkgoT().Logf("Reconcile returned an error (expected if clone failed): %v", err) - } - - mockCommander.AssertExpectations(GinkgoT()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - }, "10s", "100ms").Should(Succeed()) - }) - - It("should fail if Git clone fails", func() { - cdk8sAppProxy.Spec.GitRepository = &addonsv1alpha1.GitRepositorySpec{ - URL: "file:///nonexistentpath/to/trigger/clonefailure", - } - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).To(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionFalse)) - g.Expect(cond.Reason).To(Equal(addonsv1alpha1.GitCloneFailedReason)) - }, "10s", "100ms").Should(Succeed()) - }) - - It("should fail if Git checkout fails", func() { - cdk8sAppProxy.Spec.GitRepository = &addonsv1alpha1.GitRepositorySpec{ - URL: "https://github.com/kubernetes-sigs/cluster-api.git", - Reference: "refs/heads/non-existent-branch-for-testing", - } - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).To(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionFalse)) - g.Expect(cond.Reason).To(Or(Equal(addonsv1alpha1.GitCheckoutFailedReason), Equal(addonsv1alpha1.GitCloneFailedReason))) - }, "20s", "200ms").Should(Succeed()) - }) - - It("should fail if no source is specified", func() { - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("no source specified")) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionFalse)) - g.Expect(cond.Reason).To(Equal(addonsv1alpha1.SourceNotSpecifiedReason)) - }, "10s", "100ms").Should(Succeed()) - }) - - It("should fail if cdk8s synth fails", func() { - cdk8sAppProxy.Spec.LocalPath = "/tmp/fake-local-path" - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - mockCommander.On("CombinedOutput", "cdk8s synth").Return([]byte("synth error output"), apierrors.NewInternalError(errors.New("synth command failed"))).Once() - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("synth command failed")) - - mockCommander.AssertExpectations(GinkgoT()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionFalse)) - g.Expect(cond.Reason).To(Equal(addonsv1alpha1.Cdk8sSynthFailedReason)) - }, "10s", "100ms").Should(Succeed()) - }) - }) - - Context("When reconciling a Cdk8sAppProxy with GitRepository authentication", func() { - var cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy - var key types.NamespacedName - var secret *corev1.Secret - - BeforeEach(func() { - ns := "default" - if testNamespace != nil { - ns = testNamespace.Name - } - - cdk8sAppProxy = &addonsv1alpha1.Cdk8sAppProxy{ - ObjectMeta: metav1.ObjectMeta{ - GenerateName: "auth-test-proxy-", - Namespace: ns, - }, - Spec: addonsv1alpha1.Cdk8sAppProxySpec{ - ClusterSelector: metav1.LabelSelector{MatchLabels: map[string]string{"env": "test"}}, - GitRepository: &addonsv1alpha1.GitRepositorySpec{ - URL: "https://example.com/git/repo.git", - }, - }, - } - Expect(k8sClient.Create(ctx, cdk8sAppProxy)).To(Succeed()) - key = types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} - - Eventually(func(g Gomega) { - err := k8sClient.Get(ctx, key, cdk8sAppProxy) - g.Expect(err).NotTo(HaveOccurred()) - if !controllerutil.ContainsFinalizer(cdk8sAppProxy, controllers.Cdk8sAppProxyFinalizer) { - controllerutil.AddFinalizer(cdk8sAppProxy, controllers.Cdk8sAppProxyFinalizer) - err = k8sClient.Update(ctx, cdk8sAppProxy) - g.Expect(err).NotTo(HaveOccurred()) - } - }, "10s", "100ms").Should(Succeed()) - }) - - AfterEach(func() { - if cdk8sAppProxy != nil && cdk8sAppProxy.UID != "" { - latestProxy := &addonsv1alpha1.Cdk8sAppProxy{} - err := k8sClient.Get(ctx, types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}, latestProxy) - if err == nil && controllerutil.ContainsFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) { - controllerutil.RemoveFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) - Expect(k8sClient.Update(ctx, latestProxy)).To(Succeed(), "Failed to remove finalizer from Cdk8sAppProxy") - } - Expect(k8sClient.Delete(ctx, cdk8sAppProxy)).To(Succeed(), "Failed to delete Cdk8sAppProxy") - Eventually(func() bool { - err := k8sClient.Get(ctx, types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}, cdk8sAppProxy) - - return apierrors.IsNotFound(err) - }, "10s", "100ms").Should(BeTrue(), "Cdk8sAppProxy not deleted") - } - if secret != nil && secret.UID != "" { - Expect(k8sClient.Delete(ctx, secret)).To(Succeed(), "Failed to delete test secret") - Eventually(func() bool { - err := k8sClient.Get(ctx, types.NamespacedName{Name: secret.Name, Namespace: secret.Namespace}, secret) - - return apierrors.IsNotFound(err) - }, "10s", "100ms").Should(BeTrue(), "Test secret not deleted") - secret = nil - } - }) - - It("should fail if AuthSecretRef specified but Secret does not exist", func() { - cdk8sAppProxy.Spec.GitRepository.AuthSecretRef = &corev1.LocalObjectReference{Name: "nonexistent-git-secret"} - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).To(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionFalse)) - g.Expect(cond.Reason).To(Equal(addonsv1alpha1.GitAuthSecretInvalidReason)) - g.Expect(cond.Message).To(ContainSubstring("Failed to get auth secret")) - }, "10s", "100ms").Should(Succeed()) - }) - - It("should fail if Secret exists but is missing required data fields", func() { - secretName := "git-secret-missing-fields" - cdk8sAppProxy.Spec.GitRepository.AuthSecretRef = &corev1.LocalObjectReference{Name: secretName} - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - secret = &corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{Name: secretName, Namespace: cdk8sAppProxy.Namespace}, - Data: map[string][]byte{"user": []byte("testuser")}, - } - Expect(k8sClient.Create(ctx, secret)).To(Succeed()) - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).To(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionFalse)) - g.Expect(cond.Reason).To(Equal(addonsv1alpha1.GitAuthSecretInvalidReason)) - g.Expect(cond.Message).To(ContainSubstring("auth secret missing username or password fields")) - }, "10s", "100ms").Should(Succeed()) - }) - - It("should fail with GitAuthenticationFailedReason for invalid credentials", func() { - secretName := "git-secret-invalid-creds" - cdk8sAppProxy.Spec.GitRepository.URL = "https://invalid-credentials.example.com/repo.git" - cdk8sAppProxy.Spec.GitRepository.AuthSecretRef = &corev1.LocalObjectReference{Name: secretName} - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - secret = &corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{Name: secretName, Namespace: cdk8sAppProxy.Namespace}, - Data: map[string][]byte{ - "username": []byte("actualtestuser"), - "password": []byte("actualtestpassword"), - }, - } - Expect(k8sClient.Create(ctx, secret)).To(Succeed()) - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).To(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionFalse)) - g.Expect(cond.Reason).To(SatisfyAny( - Equal(addonsv1alpha1.GitAuthenticationFailedReason), - Equal(addonsv1alpha1.GitCloneFailedReason), - )) - g.Expect(cond.Message).To(ContainSubstring("go-git clone failed")) - }, "10s", "100ms").Should(Succeed()) - }) - }) - - Context("When reconciling a Cdk8sAppProxy with Git change detection", func() { - var cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy - var key types.NamespacedName - var tempGitRepoPath string - var cleanupTempGitRepo func() - - BeforeEach(func() { - ns := "default" - - tempGitRepoPath, cleanupTempGitRepo = setupTempGitRepo(NewGomegaWithT(GinkgoT())) - - cdk8sAppProxy = &addonsv1alpha1.Cdk8sAppProxy{ - ObjectMeta: metav1.ObjectMeta{ - GenerateName: "git-change-test-", - Namespace: ns, - }, - Spec: addonsv1alpha1.Cdk8sAppProxySpec{ - ClusterSelector: metav1.LabelSelector{MatchLabels: map[string]string{"env": "test"}}, - GitRepository: &addonsv1alpha1.GitRepositorySpec{ - URL: fmt.Sprintf("file://%s", tempGitRepoPath), - }, - }, - } - Expect(k8sClient.Create(ctx, cdk8sAppProxy)).To(Succeed()) - key = types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} - - Eventually(func(g Gomega) { - err := k8sClient.Get(ctx, key, cdk8sAppProxy) - g.Expect(err).NotTo(HaveOccurred()) - if !controllerutil.ContainsFinalizer(cdk8sAppProxy, controllers.Cdk8sAppProxyFinalizer) { - controllerutil.AddFinalizer(cdk8sAppProxy, controllers.Cdk8sAppProxyFinalizer) - err = k8sClient.Update(ctx, cdk8sAppProxy) - g.Expect(err).NotTo(HaveOccurred()) - } - }, "10s", "100ms").Should(Succeed()) - }) - - AfterEach(func() { - if cleanupTempGitRepo != nil { - cleanupTempGitRepo() - } - if cdk8sAppProxy != nil && cdk8sAppProxy.UID != "" { - latestProxy := &addonsv1alpha1.Cdk8sAppProxy{} - err := k8sClient.Get(ctx, types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}, latestProxy) - if err == nil && controllerutil.ContainsFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) { - controllerutil.RemoveFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) - Expect(k8sClient.Update(ctx, latestProxy)).To(Succeed(), "Failed to remove finalizer") - } - Expect(k8sClient.Delete(ctx, cdk8sAppProxy)).To(Succeed(), "Failed to delete Cdk8sAppProxy") - Eventually(func() bool { - err := k8sClient.Get(ctx, types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace}, cdk8sAppProxy) - return apierrors.IsNotFound(err) - }, "10s", "100ms").Should(BeTrue(), "Cdk8sAppProxy not deleted") - } - }) - - It("TestInitialDeployment: should synth and update hash if LastProcessedGitHash is empty", func() { - commitHash := makeGitCommit(NewGomegaWithT(GinkgoT()), tempGitRepoPath, "Initial commit", "init.txt") - - distDir := filepath.Join(tempGitRepoPath, "dist") - Expect(os.Mkdir(distDir, 0755)).To(Succeed()) - dummyManifest := `apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: test-cm-initial\n` - Expect(os.WriteFile(filepath.Join(distDir, "manifest.yaml"), []byte(dummyManifest), 0644)).To(Succeed()) - - mockCommander.On("CombinedOutput", "cdk8s synth").Return([]byte("synth success output"), nil).Once() - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - mockCommander.AssertExpectations(GinkgoT()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - g.Expect(proxy.Status.LastProcessedGitHash).To(Equal(commitHash)) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Reason).To(Equal(addonsv1alpha1.NoMatchingClustersReason)) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionFalse)) - g.Expect(proxy.Status.ObservedGeneration).To(Equal(proxy.Generation)) - }, "10s", "100ms").Should(Succeed()) - }) - - It("TestNoGitChange: should not synth if commit hash matches LastProcessedGitHash", func() { - commitHash := makeGitCommit(NewGomegaWithT(GinkgoT()), tempGitRepoPath, "First commit", "nochange.txt") - - cdk8sAppProxy.Status.LastProcessedGitHash = commitHash - cdk8sAppProxy.Status.ObservedGeneration = cdk8sAppProxy.Generation - 1 - Expect(k8sClient.Status().Update(ctx, cdk8sAppProxy)).To(Succeed()) - - Expect(k8sClient.Get(ctx, key, cdk8sAppProxy)).To(Succeed()) - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - g.Expect(proxy.Status.LastProcessedGitHash).To(Equal(commitHash)) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionTrue)) - g.Expect(proxy.Status.ObservedGeneration).To(Equal(proxy.Generation)) - }, "10s", "100ms").Should(Succeed()) - }) - - It("TestGitChangeDetected: should synth and update hash if new commit detected", func() { - oldCommitHash := makeGitCommit(NewGomegaWithT(GinkgoT()), tempGitRepoPath, "Old commit", "change.txt") - - cdk8sAppProxy.Status.LastProcessedGitHash = oldCommitHash - Expect(k8sClient.Status().Update(ctx, cdk8sAppProxy)).To(Succeed()) - Expect(k8sClient.Get(ctx, key, cdk8sAppProxy)).To(Succeed()) - - newCommitHash := makeGitCommit(NewGomegaWithT(GinkgoT()), tempGitRepoPath, "New commit", "change.txt") - - distDir := filepath.Join(tempGitRepoPath, "dist") - Expect(os.MkdirAll(distDir, 0755)).To(Succeed()) - dummyManifest := `apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: test-cm-change\n` - Expect(os.WriteFile(filepath.Join(distDir, "manifest-new.yaml"), []byte(dummyManifest), 0644)).To(Succeed()) - - mockCommander.On("CombinedOutput", "cdk8s synth").Return([]byte("synth success after change"), nil).Once() - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - mockCommander.AssertExpectations(GinkgoT()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - g.Expect(proxy.Status.LastProcessedGitHash).To(Equal(newCommitHash)) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Reason).To(Equal(addonsv1alpha1.NoMatchingClustersReason)) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionFalse)) - g.Expect(proxy.Status.ObservedGeneration).To(Equal(proxy.Generation)) - }, "10s", "100ms").Should(Succeed()) - }) - - It("TestGitFetchHeadError: should fail gracefully if .git is corrupted (simulating Head() error)", func() { - makeGitCommit(NewGomegaWithT(GinkgoT()), tempGitRepoPath, "Initial commit", "headerror.txt") - - headFilePath := filepath.Join(tempGitRepoPath, ".git", "HEAD") - Expect(os.WriteFile(headFilePath, []byte("ref: refs/heads/nonexistent"), 0644)).To(Succeed()) - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).To(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - cond := conditions.Get(proxy, addonsv1alpha1.DeploymentProgressingCondition) - g.Expect(cond).NotTo(BeNil()) - g.Expect(cond.Status).To(BeEquivalentTo(metav1.ConditionFalse)) - g.Expect(cond.Reason).To(Equal(addonsv1alpha1.GitCloneFailedReason)) - g.Expect(cond.Message).To(ContainSubstring("Failed to get HEAD reference")) - }, "10s", "100ms").Should(Succeed()) - }) - }) - - Context("TestWatchResourceDeletedTriggersAnnotation", func() { - var cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy - var key types.NamespacedName - var fakeDynClient *dynamicfake.FakeDynamicClient - var watchChan chan watch.Event - var reconcilerWithFakeClient *controllers.Cdk8sAppProxyReconciler - - BeforeEach(func() { - ns := "default" - if testNamespace != nil { - ns = testNamespace.Name - } - ctrl.SetLogger(testLog) - - cdk8sAppProxy = &addonsv1alpha1.Cdk8sAppProxy{ - ObjectMeta: metav1.ObjectMeta{ - Name: "watch-trigger-test-proxy", - Namespace: ns, - UID: "test-uid-proxy", - }, - Spec: addonsv1alpha1.Cdk8sAppProxySpec{ - LocalPath: "/tmp/dummy-local-path-for-watch-test", - ClusterSelector: metav1.LabelSelector{MatchLabels: map[string]string{"watch-test-cluster": "true"}}, - }, - } - - fakeK8sClient = fake.NewClientBuilder().WithScheme(fakeScheme).WithObjects(cdk8sAppProxy.DeepCopy()).Build() - reconcilerWithFakeClient = &controllers.Cdk8sAppProxyReconciler{ - Client: fakeK8sClient, - Scheme: fakeScheme, - ActiveWatches: make(map[types.NamespacedName]map[string]context.CancelFunc), - } - key = types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} - - mockCommander.On("CombinedOutput", "cdk8s synth").Return([]byte(` -apiVersion: v1 -kind: ConfigMap -metadata: - name: watched-resource - namespace: default -`), nil).Once() - - fakeDynClient = dynamicfake.NewSimpleDynamicClient(runtime.NewScheme()) - watchChan = make(chan watch.Event) - fakeDynClient.PrependWatchReactor("*", func(action kubetesting.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - testLog.Info("FakeDynamicClient Watch called", "gvr", gvr, "ns", ns) - return true, watch.NewProxyWatcher(watchChan), nil - }) - - originalGetDynamicClientFunc = controllers.GetDynamicClientForClusterFunc - controllers.GetDynamicClientForClusterFunc = func(ctx context.Context, secretNamespace string, clusterName string, proxy client.Client) (dynamic.Interface, error) { - return fakeDynClient, nil - } - - dummyCluster := &unstructured.Unstructured{ - Object: map[string]interface{}{ - "apiVersion": "cluster.x-k8s.io/v1beta1", - "kind": "Cluster", - "metadata": map[string]interface{}{ - "name": "watched-cluster", - "namespace": ns, - "labels": map[string]interface{}{"watch-test-cluster": "true"}, - "uid": "test-uid-cluster", - }, - "spec": map[string]interface{}{}, - "status": map[string]interface{}{"infrastructureReady": true}, - }, - } - - Expect(fakeK8sClient.Create(ctx, cdk8sAppProxy.DeepCopy())).To(Succeed()) - Expect(fakeK8sClient.Create(ctx, dummyCluster.DeepCopy())).To(Succeed()) - - Expect(fakeK8sClient.Get(ctx, key, cdk8sAppProxy)).To(Succeed()) - controllerutil.AddFinalizer(cdk8sAppProxy, controllers.Cdk8sAppProxyFinalizer) - Expect(fakeK8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - }) - - AfterEach(func() { - controllers.GetDynamicClientForClusterFunc = originalGetDynamicClientFunc - close(watchChan) - - latestProxy := &addonsv1alpha1.Cdk8sAppProxy{} - err := fakeK8sClient.Get(ctx, key, latestProxy) - if err == nil && controllerutil.ContainsFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) { - controllerutil.RemoveFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) - Expect(fakeK8sClient.Update(ctx, latestProxy)).To(Succeed()) - } - Expect(fakeK8sClient.Delete(ctx, cdk8sAppProxy)).To(Succeed()) - - dummyCluster := &unstructured.Unstructured{} - dummyCluster.SetAPIVersion("cluster.x-k8s.io/v1beta1") - dummyCluster.SetKind("Cluster") - dummyCluster.SetName("watched-cluster") - dummyCluster.SetNamespace(cdk8sAppProxy.Namespace) - Expect(fakeK8sClient.Delete(ctx, dummyCluster)).To(Succeed()) - - mu.Lock() - reconciler.ActiveWatches = make(map[types.NamespacedName]map[string]context.CancelFunc) - mu.Unlock() - reconcilerWithFakeClient.ActiveWatches = make(map[types.NamespacedName]map[string]context.CancelFunc) - }) - - It("should trigger re-reconciliation by annotating parent proxy when a watched resource is deleted", func() { - _, err := reconcilerWithFakeClient.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - mockCommander.AssertExpectations(GinkgoT()) - - proxyNamespacedName := types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} - var watchKeyFound string - Eventually(func() bool { - mu.Lock() - defer mu.Unlock() - if watchesForProxy, ok := reconcilerWithFakeClient.ActiveWatches[proxyNamespacedName]; ok { - for k := range watchesForProxy { - watchKeyFound = k - return true - } - } - return false - }, "10s", "100ms").Should(BeTrue(), "Watch was not established") - Expect(watchKeyFound).NotTo(BeEmpty()) - - deletedResource := &unstructured.Unstructured{ - Object: map[string]interface{}{ - "apiVersion": "v1", - "kind": "ConfigMap", - "metadata": map[string]interface{}{"name": "watched-resource", "namespace": "default"}, - }, - } - watchChan <- watch.Event{Type: watch.Deleted, Object: deletedResource} - - Eventually(func(g Gomega) { - updatedProxy := &addonsv1alpha1.Cdk8sAppProxy{} - err := reconcilerWithFakeClient.Client.Get(ctx, key, updatedProxy) - g.Expect(err).NotTo(HaveOccurred()) - g.Expect(updatedProxy.Annotations).NotTo(BeNil()) - g.Expect(updatedProxy.Annotations).To(HaveKey("cdk8s.addons.cluster.x-k8s.io/reconcile-on-delete-trigger")) - g.Expect(updatedProxy.Annotations["cdk8s.addons.cluster.x-k8s.io/reconcile-on-delete-trigger"]).NotTo(BeEmpty()) - - mu.Lock() - defer mu.Unlock() - g.Expect(reconcilerWithFakeClient.ActiveWatches[proxyNamespacedName]).To(Not(HaveKey(watchKeyFound)), "Watch was not removed from active watches") - }, "10s", "200ms").Should(Succeed()) - }) - }) - - Context("When handling finalizers", func() { - var cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy - var key types.NamespacedName - - BeforeEach(func() { - ns := "default" - if testNamespace != nil { - ns = testNamespace.Name - } - - cdk8sAppProxy = &addonsv1alpha1.Cdk8sAppProxy{ - ObjectMeta: metav1.ObjectMeta{ - Name: "finalizer-test-proxy", - Namespace: ns, - }, - Spec: addonsv1alpha1.Cdk8sAppProxySpec{ - LocalPath: "/tmp/test-path", - ClusterSelector: metav1.LabelSelector{MatchLabels: map[string]string{"env": "test"}}, - }, - } - Expect(k8sClient.Create(ctx, cdk8sAppProxy)).To(Succeed()) - key = types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} - }) - - AfterEach(func() { - if cdk8sAppProxy != nil && cdk8sAppProxy.UID != "" { - latestProxy := &addonsv1alpha1.Cdk8sAppProxy{} - err := k8sClient.Get(ctx, key, latestProxy) - if err == nil && controllerutil.ContainsFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) { - controllerutil.RemoveFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) - Expect(k8sClient.Update(ctx, latestProxy)).To(Succeed()) - } - Expect(k8sClient.Delete(ctx, cdk8sAppProxy)).To(Succeed()) - } - }) - - It("should add finalizer on first reconcile", func() { - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - g.Expect(controllerutil.ContainsFinalizer(proxy, controllers.Cdk8sAppProxyFinalizer)).To(BeTrue()) - }, "10s", "100ms").Should(Succeed()) - }) - - It("should handle deletion and cleanup watches", func() { - mockCommander.On("CombinedOutput", "cdk8s synth").Return([]byte("synth success"), nil).Once() - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - - Expect(k8sClient.Get(ctx, key, cdk8sAppProxy)).To(Succeed()) - Expect(k8sClient.Delete(ctx, cdk8sAppProxy)).To(Succeed()) - - _, err = reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - - Eventually(func() bool { - err := k8sClient.Get(ctx, key, cdk8sAppProxy) - return apierrors.IsNotFound(err) - }, "10s", "100ms").Should(BeTrue()) - - Expect(reconciler.ActiveWatches).NotTo(HaveKey(key)) - }) - }) - - Context("When testing cluster selection", func() { - var cdk8sAppProxy *addonsv1alpha1.Cdk8sAppProxy - var cluster1, cluster2, cluster3 *unstructured.Unstructured - var key types.NamespacedName - - BeforeEach(func() { - ns := "default" - if testNamespace != nil { - ns = testNamespace.Name - } - - cluster1 = &unstructured.Unstructured{ - Object: map[string]interface{}{ - "apiVersion": "cluster.x-k8s.io/v1beta1", - "kind": "Cluster", - "metadata": map[string]interface{}{ - "name": "cluster-env-prod", - "namespace": ns, - "labels": map[string]interface{}{"env": "prod", "tier": "frontend"}, - }, - "status": map[string]interface{}{"infrastructureReady": true}, - }, - } - cluster2 = &unstructured.Unstructured{ - Object: map[string]interface{}{ - "apiVersion": "cluster.x-k8s.io/v1beta1", - "kind": "Cluster", - "metadata": map[string]interface{}{ - "name": "cluster-env-staging", - "namespace": ns, - "labels": map[string]interface{}{"env": "staging", "tier": "backend"}, - }, - "status": map[string]interface{}{"infrastructureReady": true}, - }, - } - cluster3 = &unstructured.Unstructured{ - Object: map[string]interface{}{ - "apiVersion": "cluster.x-k8s.io/v1beta1", - "kind": "Cluster", - "metadata": map[string]interface{}{ - "name": "cluster-no-env", - "namespace": ns, - "labels": map[string]interface{}{"tier": "database"}, - }, - "status": map[string]interface{}{"infrastructureReady": false}, - }, - } - - Expect(k8sClient.Create(ctx, cluster1)).To(Succeed()) - Expect(k8sClient.Create(ctx, cluster2)).To(Succeed()) - Expect(k8sClient.Create(ctx, cluster3)).To(Succeed()) - - tempDir, err := os.MkdirTemp("", "cluster-selector-test-") - Expect(err).NotTo(HaveOccurred()) - distDir := filepath.Join(tempDir, "dist") - Expect(os.Mkdir(distDir, 0755)).To(Succeed()) - dummyManifest := `apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: test-cm\n` - Expect(os.WriteFile(filepath.Join(distDir, "manifest.yaml"), []byte(dummyManifest), 0644)).To(Succeed()) - - cdk8sAppProxy = &addonsv1alpha1.Cdk8sAppProxy{ - ObjectMeta: metav1.ObjectMeta{ - Name: "cluster-selector-test", - Namespace: ns, - }, - Spec: addonsv1alpha1.Cdk8sAppProxySpec{ - LocalPath: tempDir, - }, - } - Expect(k8sClient.Create(ctx, cdk8sAppProxy)).To(Succeed()) - key = types.NamespacedName{Name: cdk8sAppProxy.Name, Namespace: cdk8sAppProxy.Namespace} - - DeferCleanup(func() { - os.RemoveAll(tempDir) - }) - }) - - AfterEach(func() { - resources := []*unstructured.Unstructured{cluster1, cluster2, cluster3} - for _, resource := range resources { - if resource != nil { - Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) - } - } - - if cdk8sAppProxy != nil { - latestProxy := &addonsv1alpha1.Cdk8sAppProxy{} - err := k8sClient.Get(ctx, key, latestProxy) - if err == nil && controllerutil.ContainsFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) { - controllerutil.RemoveFinalizer(latestProxy, controllers.Cdk8sAppProxyFinalizer) - Expect(k8sClient.Update(ctx, latestProxy)).To(Succeed()) - } - Expect(k8sClient.Delete(ctx, cdk8sAppProxy)).To(Succeed()) - } - }) - - It("should select clusters matching single label", func() { - cdk8sAppProxy.Spec.ClusterSelector = metav1.LabelSelector{ - MatchLabels: map[string]string{"env": "prod"}, - } - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - mockCommander.On("CombinedOutput", "cdk8s synth").Return([]byte("synth success"), nil).Once() - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - g.Expect(proxy.Status.SelectedClusters).To(HaveLen(1)) - g.Expect(proxy.Status.SelectedClusters[0]).To(Equal("cluster-env-prod")) - }, "10s", "100ms").Should(Succeed()) - }) - - It("should select clusters matching multiple labels", func() { - cdk8sAppProxy.Spec.ClusterSelector = metav1.LabelSelector{ - MatchLabels: map[string]string{"tier": "backend"}, - } - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - mockCommander.On("CombinedOutput", "cdk8s synth").Return([]byte("synth success"), nil).Once() - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - g.Expect(proxy.Status.SelectedClusters).To(HaveLen(1)) - g.Expect(proxy.Status.SelectedClusters[0]).To(Equal("cluster-env-staging")) - }, "10s", "100ms").Should(Succeed()) - }) - - It("should handle empty selector (select all ready clusters)", func() { - cdk8sAppProxy.Spec.ClusterSelector = metav1.LabelSelector{} - Expect(k8sClient.Update(ctx, cdk8sAppProxy)).To(Succeed()) - - mockCommander.On("CombinedOutput", "cdk8s synth").Return([]byte("synth success"), nil).Once() - - _, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: key}) - Expect(err).NotTo(HaveOccurred()) - - Eventually(func(g Gomega) { - proxy := &addonsv1alpha1.Cdk8sAppProxy{} - g.Expect(k8sClient.Get(ctx, key, proxy)).To(Succeed()) - g.Expect(proxy.Status.SelectedClusters).To(HaveLen(2)) - g.Expect(proxy.Status.SelectedClusters).To(ContainElements("cluster-env-prod", "cluster-env-staging")) - }, "10s", "100ms").Should(Succeed()) - }) - }) -}) - -// Helper functions for Git repo management in tests -func setupTempGitRepo(g *WithT) (string, func()) { - repoPath, err := os.MkdirTemp("", "test-git-repo-") - g.Expect(err).NotTo(HaveOccurred()) - cmd := exec.Command("git", "init") - cmd.Dir = repoPath - output, err := cmd.CombinedOutput() - g.Expect(err).NotTo(HaveOccurred(), "Failed to git init: %s", string(output)) - - cmd = exec.Command("git", "config", "user.email", "test@example.com") - cmd.Dir = repoPath - output, err = cmd.CombinedOutput() - g.Expect(err).NotTo(HaveOccurred(), "Failed to set git user.email: %s", string(output)) - - cmd = exec.Command("git", "config", "user.name", "Test User") - cmd.Dir = repoPath - output, err = cmd.CombinedOutput() - g.Expect(err).NotTo(HaveOccurred(), "Failed to set git user.name: %s", string(output)) - - cleanup := func() { - os.RemoveAll(repoPath) - } - return repoPath, cleanup -} - -func makeGitCommit(g *WithT, repoPath, message, fileName string) string { - if fileName == "" { - fileName = "file.txt" - } - filePath := filepath.Join(repoPath, fileName) - err := os.WriteFile(filePath, []byte(message), 0644) - g.Expect(err).NotTo(HaveOccurred()) - - cmd := exec.Command("git", "add", filePath) - cmd.Dir = repoPath - output, err := cmd.CombinedOutput() - g.Expect(err).NotTo(HaveOccurred(), "Failed to git add: %s", string(output)) - - cmd = exec.Command("git", "commit", "-m", message) - cmd.Dir = repoPath - output, err = cmd.CombinedOutput() - g.Expect(err).NotTo(HaveOccurred(), "Failed to git commit: %s", string(output)) - - repo, err := git.PlainOpen(repoPath) - g.Expect(err).NotTo(HaveOccurred()) - headRef, err := repo.Head() - g.Expect(err).NotTo(HaveOccurred()) - return headRef.Hash().String() -} diff --git a/controllers/suite_test.go b/controllers/suite_test.go index f961a3a..6742284 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -23,7 +23,7 @@ import ( "testing" addonsv1alpha1 "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/api/v1alpha1" - "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/controllers" + caapccontroller "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/controllers/cdk8sappproxy" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "k8s.io/client-go/kubernetes/scheme" @@ -32,7 +32,6 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - crcontroller "sigs.k8s.io/controller-runtime/pkg/controller" // Added for controller.Options "sigs.k8s.io/controller-runtime/pkg/envtest" "sigs.k8s.io/controller-runtime/pkg/manager" metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" @@ -49,27 +48,12 @@ var ( cancel context.CancelFunc ) -// const ( // Unused constants -// timeout = time.Second * 10 -// interval = time.Millisecond * 250 -// ) - func TestControllers(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Controller Suite") } -// Removed TestReporter struct and its methods as gomock is no longer used here -// var _ gomock.TestReporter = (*TestReporter)(nil) -// type TestReporter struct{} -// func (c TestReporter) Errorf(format string, args ...any) { -// panic(fmt.Sprintf(format, args...)) -// } -// func (c TestReporter) Fatalf(format string, args ...any) { -// panic(fmt.Sprintf(format, args...)) -// } - var _ = BeforeSuite(func() { ctx, cancel = context.WithCancel(context.TODO()) @@ -103,11 +87,6 @@ var _ = BeforeSuite(func() { Expect(err).NotTo(HaveOccurred()) Expect(k8sClient).NotTo(BeNil()) - // Remove namespace creation if it's specific to Helm tests - // for _, namespace := range namespaces { - // Expect(k8sClient.Create(ctx, &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: namespace}})).NotTo(HaveOccurred()) - // } - k8sManager, err = ctrl.NewManager(cfg, ctrl.Options{ Scheme: scheme.Scheme, Metrics: metricsserver.Options{ @@ -116,13 +95,13 @@ var _ = BeforeSuite(func() { HealthProbeBindAddress: "0", }) Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) // k8sManager was already checked + Expect(k8sClient).NotTo(BeNil()) // Setup Cdk8sAppProxyReconciler - err = (&controllers.Cdk8sAppProxyReconciler{ // Added 'controllers.' qualifier + err = (&caapccontroller.Reconciler{ Client: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), - }).SetupWithManager(k8sManager, crcontroller.Options{}) // Use crcontroller.Options{} + }).SetupWithManager(k8sManager) Expect(err).ToNot(HaveOccurred()) go func() { diff --git a/docs/quick-start.md b/docs/quick-start.md new file mode 100644 index 0000000..cbfa7bb --- /dev/null +++ b/docs/quick-start.md @@ -0,0 +1 @@ +# Quick start \ No newline at end of file diff --git a/examples/cdk8s-sample-deployment/cdk8s.yaml b/examples/cdk8s-sample-deployment/cdk8s.yaml new file mode 100644 index 0000000..fb0b3b5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/cdk8s.yaml @@ -0,0 +1,4 @@ +language: go +app: go run . +imports: + - k8s diff --git a/examples/cdk8s-sample-deployment/go.mod b/examples/cdk8s-sample-deployment/go.mod new file mode 100644 index 0000000..35a9bf7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/go.mod @@ -0,0 +1,26 @@ +module example.com/cdk8s-test + +go 1.24.4 + +require ( + github.com/aws/constructs-go/constructs/v10 v10.3.0 + github.com/aws/jsii-runtime-go v1.98.0 + github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2 v2.68.70 +) + +require ( + github.com/Masterminds/semver/v3 v3.3.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/fatih/color v1.18.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/stretchr/testify v1.10.0 // indirect + github.com/yuin/goldmark v1.4.13 // indirect + golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect + golang.org/x/mod v0.24.0 // indirect + golang.org/x/sync v0.14.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/tools v0.33.0 // indirect +) diff --git a/examples/cdk8s-sample-deployment/go.sum b/examples/cdk8s-sample-deployment/go.sum new file mode 100644 index 0000000..0a848f0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/go.sum @@ -0,0 +1,49 @@ +github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4= +github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/aws/constructs-go/constructs/v10 v10.3.0 h1:LsjBIMiaDX/vqrXWhzTquBJ9pPdi02/H+z1DCwg0PEM= +github.com/aws/constructs-go/constructs/v10 v10.3.0/go.mod h1:GgzwIwoRJ2UYsr3SU+JhAl+gq5j39bEMYf8ev3J+s9s= +github.com/aws/jsii-runtime-go v1.98.0 h1:ulW8WgW9xchCkGc8SBKSQwpm+4/MwoFkYuCsOD8NnMU= +github.com/aws/jsii-runtime-go v1.98.0/go.mod h1:30XYoqvHizeedL8KNra3DBZ9w+NtJDQpbU4o1bN9lVc= +github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2 v2.68.70 h1:0sS7tHQraB3OtVpS6IElkwwb0XJcCIapo6brFs3IGoQ= +github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2 v2.68.70/go.mod h1:Pkx19GlJctsR6wchtjV81yKCwdj4K/i+5dRKt6i4HTw= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= +golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= +golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/examples/cdk8s-sample-deployment/help b/examples/cdk8s-sample-deployment/help new file mode 100644 index 0000000..9a4417a --- /dev/null +++ b/examples/cdk8s-sample-deployment/help @@ -0,0 +1,12 @@ +======================================================================================================== + + Your cdk8s Go project is ready! + + cat help Prints this message + cdk8s synth Synthesize k8s manifests to dist/ + cdk8s import Imports k8s API objects to "imports/k8s" + + Deploy: + kubectl apply -f dist/ + +======================================================================================================== diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Affinity.go b/examples/cdk8s-sample-deployment/imports/k8s/Affinity.go new file mode 100644 index 0000000..29ea373 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Affinity.go @@ -0,0 +1,13 @@ +package k8s + + +// Affinity is a group of affinity scheduling rules. +type Affinity struct { + // Describes node affinity scheduling rules for the pod. + NodeAffinity *NodeAffinity `field:"optional" json:"nodeAffinity" yaml:"nodeAffinity"` + // Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)). + PodAffinity *PodAffinity `field:"optional" json:"podAffinity" yaml:"podAffinity"` + // Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)). + PodAntiAffinity *PodAntiAffinity `field:"optional" json:"podAntiAffinity" yaml:"podAntiAffinity"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/AggregationRule.go b/examples/cdk8s-sample-deployment/imports/k8s/AggregationRule.go new file mode 100644 index 0000000..5931354 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/AggregationRule.go @@ -0,0 +1,11 @@ +package k8s + + +// AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole. +type AggregationRule struct { + // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. + // + // If any of the selectors match, then the ClusterRole's permissions will be added. + ClusterRoleSelectors *[]*LabelSelector `field:"optional" json:"clusterRoleSelectors" yaml:"clusterRoleSelectors"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ApiServiceSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/ApiServiceSpec.go new file mode 100644 index 0000000..0a22ee0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ApiServiceSpec.go @@ -0,0 +1,35 @@ +package k8s + + +// APIServiceSpec contains information for locating and communicating with a server. +// +// Only https is supported, though you are able to disable certificate verification. +type ApiServiceSpec struct { + // GroupPriorityMininum is the priority this group should have at least. + // + // Higher priority means that the group is preferred by clients over lower priority ones. Note that other versions of this group might specify even higher GroupPriorityMininum values such that the whole group gets a higher priority. The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10). The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) We'd recommend something like: *.k8s.io (except extensions) at 18000 and PaaSes (OpenShift, Deis) are recommended to be in the 2000s + GroupPriorityMinimum *float64 `field:"required" json:"groupPriorityMinimum" yaml:"groupPriorityMinimum"` + // VersionPriority controls the ordering of this API version inside of its group. + // + // Must be greater than zero. The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). Since it's inside of a group, the number can be small, probably in the 10s. In case of equal version priorities, the version string will be used to compute the order inside a group. If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10. + VersionPriority *float64 `field:"required" json:"versionPriority" yaml:"versionPriority"` + // CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate. + // + // If unspecified, system trust roots on the apiserver are used. + CaBundle *string `field:"optional" json:"caBundle" yaml:"caBundle"` + // Group is the API group name this server hosts. + Group *string `field:"optional" json:"group" yaml:"group"` + // InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. + // + // This is strongly discouraged. You should use the CABundle instead. + InsecureSkipTlsVerify *bool `field:"optional" json:"insecureSkipTlsVerify" yaml:"insecureSkipTlsVerify"` + // Service is a reference to the service for this API server. + // + // It must communicate on port 443. If the Service is nil, that means the handling for the API groupversion is handled locally on this server. The call will simply delegate to the normal handler chain to be fulfilled. + Service *ServiceReference `field:"optional" json:"service" yaml:"service"` + // Version is the API version this server hosts. + // + // For example, "v1". + Version *string `field:"optional" json:"version" yaml:"version"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/AwsElasticBlockStoreVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/AwsElasticBlockStoreVolumeSource.go new file mode 100644 index 0000000..f6f3c34 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/AwsElasticBlockStoreVolumeSource.go @@ -0,0 +1,25 @@ +package k8s + + +// Represents a Persistent Disk resource in AWS. +// +// An AWS EBS disk must exist before mounting to a container. The disk must also be in the same AWS zone as the kubelet. An AWS EBS disk can only be mounted as read/write once. AWS EBS volumes support ownership management and SELinux relabeling. +type AwsElasticBlockStoreVolumeSource struct { + // volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + VolumeId *string `field:"required" json:"volumeId" yaml:"volumeId"` + // fsType is the filesystem type of the volume that you want to mount. + // + // Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // partition is the partition in the volume that you want to mount. + // + // If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + Partition *float64 `field:"optional" json:"partition" yaml:"partition"` + // readOnly value true will force the readOnly setting in VolumeMounts. + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/AzureDiskVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/AzureDiskVolumeSource.go new file mode 100644 index 0000000..546e1f6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/AzureDiskVolumeSource.go @@ -0,0 +1,27 @@ +package k8s + + +// AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. +type AzureDiskVolumeSource struct { + // diskName is the Name of the data disk in the blob storage. + DiskName *string `field:"required" json:"diskName" yaml:"diskName"` + // diskURI is the URI of data disk in the blob storage. + DiskUri *string `field:"required" json:"diskUri" yaml:"diskUri"` + // cachingMode is the Host Caching mode: None, Read Only, Read Write. + CachingMode *string `field:"optional" json:"cachingMode" yaml:"cachingMode"` + // fsType is Filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // kind expected values are Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). + // + // defaults to shared. + Kind *string `field:"optional" json:"kind" yaml:"kind"` + // readOnly Defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + // Default: false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/AzureFilePersistentVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/AzureFilePersistentVolumeSource.go new file mode 100644 index 0000000..2fcf809 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/AzureFilePersistentVolumeSource.go @@ -0,0 +1,17 @@ +package k8s + + +// AzureFile represents an Azure File Service mount on the host and bind mount to the pod. +type AzureFilePersistentVolumeSource struct { + // secretName is the name of secret that contains Azure Storage Account Name and Key. + SecretName *string `field:"required" json:"secretName" yaml:"secretName"` + // shareName is the azure Share Name. + ShareName *string `field:"required" json:"shareName" yaml:"shareName"` + // readOnly defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretNamespace is the namespace of the secret that contains Azure Storage Account Name and Key default is the same as the Pod. + SecretNamespace *string `field:"optional" json:"secretNamespace" yaml:"secretNamespace"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/AzureFileVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/AzureFileVolumeSource.go new file mode 100644 index 0000000..c6958d0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/AzureFileVolumeSource.go @@ -0,0 +1,15 @@ +package k8s + + +// AzureFile represents an Azure File Service mount on the host and bind mount to the pod. +type AzureFileVolumeSource struct { + // secretName is the name of secret that contains Azure Storage Account Name and Key. + SecretName *string `field:"required" json:"secretName" yaml:"secretName"` + // shareName is the azure share Name. + ShareName *string `field:"required" json:"shareName" yaml:"shareName"` + // readOnly defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/BoundObjectReference.go b/examples/cdk8s-sample-deployment/imports/k8s/BoundObjectReference.go new file mode 100644 index 0000000..191fa39 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/BoundObjectReference.go @@ -0,0 +1,17 @@ +package k8s + + +// BoundObjectReference is a reference to an object that a token is bound to. +type BoundObjectReference struct { + // API version of the referent. + ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"` + // Kind of the referent. + // + // Valid kinds are 'Pod' and 'Secret'. + Kind *string `field:"optional" json:"kind" yaml:"kind"` + // Name of the referent. + Name *string `field:"optional" json:"name" yaml:"name"` + // UID of the referent. + Uid *string `field:"optional" json:"uid" yaml:"uid"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Capabilities.go b/examples/cdk8s-sample-deployment/imports/k8s/Capabilities.go new file mode 100644 index 0000000..cb5fbed --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Capabilities.go @@ -0,0 +1,11 @@ +package k8s + + +// Adds and removes POSIX capabilities from running containers. +type Capabilities struct { + // Added capabilities. + Add *[]*string `field:"optional" json:"add" yaml:"add"` + // Removed capabilities. + Drop *[]*string `field:"optional" json:"drop" yaml:"drop"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CephFsPersistentVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/CephFsPersistentVolumeSource.go new file mode 100644 index 0000000..6105e9d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CephFsPersistentVolumeSource.go @@ -0,0 +1,25 @@ +package k8s + + +// Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling. +type CephFsPersistentVolumeSource struct { + // monitors is Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it. + Monitors *[]*string `field:"required" json:"monitors" yaml:"monitors"` + // path is Optional: Used as the mounted root, rather than the full Ceph tree, default is /. + Path *string `field:"optional" json:"path" yaml:"path"` + // readOnly is Optional: Defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + // Default: false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it. + SecretFile *string `field:"optional" json:"secretFile" yaml:"secretFile"` + // secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + // + // More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + SecretRef *SecretReference `field:"optional" json:"secretRef" yaml:"secretRef"` + // user is Optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it. + User *string `field:"optional" json:"user" yaml:"user"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CephFsVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/CephFsVolumeSource.go new file mode 100644 index 0000000..e88ee32 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CephFsVolumeSource.go @@ -0,0 +1,25 @@ +package k8s + + +// Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling. +type CephFsVolumeSource struct { + // monitors is Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it. + Monitors *[]*string `field:"required" json:"monitors" yaml:"monitors"` + // path is Optional: Used as the mounted root, rather than the full Ceph tree, default is /. + Path *string `field:"optional" json:"path" yaml:"path"` + // readOnly is Optional: Defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + // Default: false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it. + SecretFile *string `field:"optional" json:"secretFile" yaml:"secretFile"` + // secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + // + // More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + SecretRef *LocalObjectReference `field:"optional" json:"secretRef" yaml:"secretRef"` + // user is optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it. + User *string `field:"optional" json:"user" yaml:"user"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CertificateSigningRequestSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/CertificateSigningRequestSpec.go new file mode 100644 index 0000000..3896969 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CertificateSigningRequestSpec.go @@ -0,0 +1,79 @@ +package k8s + + +// CertificateSigningRequestSpec contains the certificate request. +type CertificateSigningRequestSpec struct { + // request contains an x509 certificate signing request encoded in a "CERTIFICATE REQUEST" PEM block. + // + // When serialized as JSON or YAML, the data is additionally base64-encoded. + Request *string `field:"required" json:"request" yaml:"request"` + // signerName indicates the requested signer, and is a qualified name. + // + // List/watch requests for CertificateSigningRequests can filter on this field using a "spec.signerName=NAME" fieldSelector. + // + // Well-known Kubernetes signers are: + // 1. "kubernetes.io/kube-apiserver-client": issues client certificates that can be used to authenticate to kube-apiserver. + // Requests for this signer are never auto-approved by kube-controller-manager, can be issued by the "csrsigning" controller in kube-controller-manager. + // 2. "kubernetes.io/kube-apiserver-client-kubelet": issues client certificates that kubelets use to authenticate to kube-apiserver. + // Requests for this signer can be auto-approved by the "csrapproving" controller in kube-controller-manager, and can be issued by the "csrsigning" controller in kube-controller-manager. + // 3. "kubernetes.io/kubelet-serving" issues serving certificates that kubelets use to serve TLS endpoints, which kube-apiserver can connect to securely. + // Requests for this signer are never auto-approved by kube-controller-manager, and can be issued by the "csrsigning" controller in kube-controller-manager. + // + // More details are available at https://k8s.io/docs/reference/access-authn-authz/certificate-signing-requests/#kubernetes-signers + // + // Custom signerNames can also be specified. The signer defines: + // 1. Trust distribution: how trust (CA bundles) are distributed. + // 2. Permitted subjects: and behavior when a disallowed subject is requested. + // 3. Required, permitted, or forbidden x509 extensions in the request (including whether subjectAltNames are allowed, which types, restrictions on allowed values) and behavior when a disallowed extension is requested. + // 4. Required, permitted, or forbidden key usages / extended key usages. + // 5. Expiration/certificate lifetime: whether it is fixed by the signer, configurable by the admin. + // 6. Whether or not requests for CA certificates are allowed. + SignerName *string `field:"required" json:"signerName" yaml:"signerName"` + // expirationSeconds is the requested duration of validity of the issued certificate. + // + // The certificate signer may issue a certificate with a different validity duration so a client must check the delta between the notBefore and and notAfter fields in the issued certificate to determine the actual duration. + // + // The v1.22+ in-tree implementations of the well-known Kubernetes signers will honor this field as long as the requested duration is not greater than the maximum duration they will honor per the --cluster-signing-duration CLI flag to the Kubernetes controller manager. + // + // Certificate signers may not honor this field for various reasons: + // + // 1. Old signer that is unaware of the field (such as the in-tree + // implementations prior to v1.22) + // 2. Signer whose configured maximum is shorter than the requested duration + // 3. Signer whose configured minimum is longer than the requested duration + // + // The minimum valid value for expirationSeconds is 600, i.e. 10 minutes. + ExpirationSeconds *float64 `field:"optional" json:"expirationSeconds" yaml:"expirationSeconds"` + // extra contains extra attributes of the user that created the CertificateSigningRequest. + // + // Populated by the API server on creation and immutable. + Extra *map[string]*[]*string `field:"optional" json:"extra" yaml:"extra"` + // groups contains group membership of the user that created the CertificateSigningRequest. + // + // Populated by the API server on creation and immutable. + Groups *[]*string `field:"optional" json:"groups" yaml:"groups"` + // uid contains the uid of the user that created the CertificateSigningRequest. + // + // Populated by the API server on creation and immutable. + Uid *string `field:"optional" json:"uid" yaml:"uid"` + // usages specifies a set of key usages requested in the issued certificate. + // + // Requests for TLS client certificates typically request: "digital signature", "key encipherment", "client auth". + // + // Requests for TLS serving certificates typically request: "key encipherment", "digital signature", "server auth". + // + // Valid values are: + // "signing", "digital signature", "content commitment", + // "key encipherment", "key agreement", "data encipherment", + // "cert sign", "crl sign", "encipher only", "decipher only", "any", + // "server auth", "client auth", + // "code signing", "email protection", "s/mime", + // "ipsec end system", "ipsec tunnel", "ipsec user", + // "timestamping", "ocsp signing", "microsoft sgc", "netscape sgc". + Usages *[]*string `field:"optional" json:"usages" yaml:"usages"` + // username contains the name of the user that created the CertificateSigningRequest. + // + // Populated by the API server on creation and immutable. + Username *string `field:"optional" json:"username" yaml:"username"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CinderPersistentVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/CinderPersistentVolumeSource.go new file mode 100644 index 0000000..083f44a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CinderPersistentVolumeSource.go @@ -0,0 +1,25 @@ +package k8s + + +// Represents a cinder volume resource in Openstack. +// +// A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling. +type CinderPersistentVolumeSource struct { + // volumeID used to identify the volume in cinder. + // + // More info: https://examples.k8s.io/mysql-cinder-pd/README.md + VolumeId *string `field:"required" json:"volumeId" yaml:"volumeId"` + // fsType Filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // readOnly is Optional: Defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + // Default: false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretRef is Optional: points to a secret object containing parameters used to connect to OpenStack. + SecretRef *SecretReference `field:"optional" json:"secretRef" yaml:"secretRef"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CinderVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/CinderVolumeSource.go new file mode 100644 index 0000000..24cd1a4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CinderVolumeSource.go @@ -0,0 +1,23 @@ +package k8s + + +// Represents a cinder volume resource in Openstack. +// +// A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling. +type CinderVolumeSource struct { + // volumeID used to identify the volume in cinder. + // + // More info: https://examples.k8s.io/mysql-cinder-pd/README.md + VolumeId *string `field:"required" json:"volumeId" yaml:"volumeId"` + // fsType is the filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // readOnly defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretRef is optional: points to a secret object containing parameters used to connect to OpenStack. + SecretRef *LocalObjectReference `field:"optional" json:"secretRef" yaml:"secretRef"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ClientIpConfig.go b/examples/cdk8s-sample-deployment/imports/k8s/ClientIpConfig.go new file mode 100644 index 0000000..5bcb01d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ClientIpConfig.go @@ -0,0 +1,11 @@ +package k8s + + +// ClientIPConfig represents the configurations of Client IP based session affinity. +type ClientIpConfig struct { + // timeoutSeconds specifies the seconds of ClientIP type session sticky time. + // + // The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP". Default value is 10800(for 3 hours). + TimeoutSeconds *float64 `field:"optional" json:"timeoutSeconds" yaml:"timeoutSeconds"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ClusterCidrSpecV1Alpha1.go b/examples/cdk8s-sample-deployment/imports/k8s/ClusterCidrSpecV1Alpha1.go new file mode 100644 index 0000000..a0c0c6c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ClusterCidrSpecV1Alpha1.go @@ -0,0 +1,19 @@ +package k8s + + +// ClusterCIDRSpec defines the desired state of ClusterCIDR. +type ClusterCidrSpecV1Alpha1 struct { + // PerNodeHostBits defines the number of host bits to be configured per node. + // + // A subnet mask determines how much of the address is used for network bits and host bits. For example an IPv4 address of 192.168.0.0/24, splits the address into 24 bits for the network portion and 8 bits for the host portion. To allocate 256 IPs, set this field to 8 (a /24 mask for IPv4 or a /120 for IPv6). Minimum value is 4 (16 IPs). This field is immutable. + PerNodeHostBits *float64 `field:"required" json:"perNodeHostBits" yaml:"perNodeHostBits"` + // IPv4 defines an IPv4 IP block in CIDR notation(e.g. "10.0.0.0/8"). At least one of IPv4 and IPv6 must be specified. This field is immutable. + Ipv4 *string `field:"optional" json:"ipv4" yaml:"ipv4"` + // IPv6 defines an IPv6 IP block in CIDR notation(e.g. "fd12:3456:789a:1::/64"). At least one of IPv4 and IPv6 must be specified. This field is immutable. + Ipv6 *string `field:"optional" json:"ipv6" yaml:"ipv6"` + // NodeSelector defines which nodes the config is applicable to. + // + // An empty or nil NodeSelector selects all nodes. This field is immutable. + NodeSelector *NodeSelector `field:"optional" json:"nodeSelector" yaml:"nodeSelector"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ComponentCondition.go b/examples/cdk8s-sample-deployment/imports/k8s/ComponentCondition.go new file mode 100644 index 0000000..5fd4a26 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ComponentCondition.go @@ -0,0 +1,23 @@ +package k8s + + +// Information about the condition of a component. +type ComponentCondition struct { + // Status of the condition for a component. + // + // Valid values for "Healthy": "True", "False", or "Unknown". + Status *string `field:"required" json:"status" yaml:"status"` + // Type of condition for a component. + // + // Valid value: "Healthy". + Type *string `field:"required" json:"type" yaml:"type"` + // Condition error code for a component. + // + // For example, a health check error code. + Error *string `field:"optional" json:"error" yaml:"error"` + // Message about the condition for a component. + // + // For example, information about a health check. + Message *string `field:"optional" json:"message" yaml:"message"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapEnvSource.go b/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapEnvSource.go new file mode 100644 index 0000000..f5ca128 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapEnvSource.go @@ -0,0 +1,15 @@ +package k8s + + +// ConfigMapEnvSource selects a ConfigMap to populate the environment variables with. +// +// The contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables. +type ConfigMapEnvSource struct { + // Name of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `field:"optional" json:"name" yaml:"name"` + // Specify whether the ConfigMap must be defined. + Optional *bool `field:"optional" json:"optional" yaml:"optional"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapKeySelector.go b/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapKeySelector.go new file mode 100644 index 0000000..95a768b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapKeySelector.go @@ -0,0 +1,15 @@ +package k8s + + +// Selects a key from a ConfigMap. +type ConfigMapKeySelector struct { + // The key to select. + Key *string `field:"required" json:"key" yaml:"key"` + // Name of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `field:"optional" json:"name" yaml:"name"` + // Specify whether the ConfigMap or its key must be defined. + Optional *bool `field:"optional" json:"optional" yaml:"optional"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapNodeConfigSource.go b/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapNodeConfigSource.go new file mode 100644 index 0000000..0440802 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapNodeConfigSource.go @@ -0,0 +1,19 @@ +package k8s + + +// ConfigMapNodeConfigSource contains the information to reference a ConfigMap as a config source for the Node. +// +// This API is deprecated since 1.22: https://git.k8s.io/enhancements/keps/sig-node/281-dynamic-kubelet-configuration +type ConfigMapNodeConfigSource struct { + // KubeletConfigKey declares which key of the referenced ConfigMap corresponds to the KubeletConfiguration structure This field is required in all cases. + KubeletConfigKey *string `field:"required" json:"kubeletConfigKey" yaml:"kubeletConfigKey"` + // Name is the metadata.name of the referenced ConfigMap. This field is required in all cases. + Name *string `field:"required" json:"name" yaml:"name"` + // Namespace is the metadata.namespace of the referenced ConfigMap. This field is required in all cases. + Namespace *string `field:"required" json:"namespace" yaml:"namespace"` + // ResourceVersion is the metadata.ResourceVersion of the referenced ConfigMap. This field is forbidden in Node.Spec, and required in Node.Status. + ResourceVersion *string `field:"optional" json:"resourceVersion" yaml:"resourceVersion"` + // UID is the metadata.UID of the referenced ConfigMap. This field is forbidden in Node.Spec, and required in Node.Status. + Uid *string `field:"optional" json:"uid" yaml:"uid"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapProjection.go b/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapProjection.go new file mode 100644 index 0000000..82031d5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapProjection.go @@ -0,0 +1,19 @@ +package k8s + + +// Adapts a ConfigMap into a projected volume. +// +// The contents of the target ConfigMap's Data field will be presented in a projected volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. Note that this is identical to a configmap volume source without the default mode. +type ConfigMapProjection struct { + // items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. + // + // If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + Items *[]*KeyToPath `field:"optional" json:"items" yaml:"items"` + // Name of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `field:"optional" json:"name" yaml:"name"` + // optional specify whether the ConfigMap or its keys must be defined. + Optional *bool `field:"optional" json:"optional" yaml:"optional"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapVolumeSource.go new file mode 100644 index 0000000..473ae04 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ConfigMapVolumeSource.go @@ -0,0 +1,25 @@ +package k8s + + +// Adapts a ConfigMap into a volume. +// +// The contents of the target ConfigMap's Data field will be presented in a volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. ConfigMap volumes support ownership management and SELinux relabeling. +type ConfigMapVolumeSource struct { + // defaultMode is optional: mode bits used to set permissions on created files by default. + // + // Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + // Default: 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + // + DefaultMode *float64 `field:"optional" json:"defaultMode" yaml:"defaultMode"` + // items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. + // + // If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + Items *[]*KeyToPath `field:"optional" json:"items" yaml:"items"` + // Name of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `field:"optional" json:"name" yaml:"name"` + // optional specify whether the ConfigMap or its keys must be defined. + Optional *bool `field:"optional" json:"optional" yaml:"optional"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Container.go b/examples/cdk8s-sample-deployment/imports/k8s/Container.go new file mode 100644 index 0000000..d09b2ca --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Container.go @@ -0,0 +1,105 @@ +package k8s + + +// A single application container that you want to run within a pod. +type Container struct { + // Name of the container specified as a DNS_LABEL. + // + // Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated. + Name *string `field:"required" json:"name" yaml:"name"` + // Arguments to the entrypoint. + // + // The container image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + Args *[]*string `field:"optional" json:"args" yaml:"args"` + // Entrypoint array. + // + // Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + Command *[]*string `field:"optional" json:"command" yaml:"command"` + // List of environment variables to set in the container. + // + // Cannot be updated. + Env *[]*EnvVar `field:"optional" json:"env" yaml:"env"` + // List of sources to populate environment variables in the container. + // + // The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated. + EnvFrom *[]*EnvFromSource `field:"optional" json:"envFrom" yaml:"envFrom"` + // Container image name. + // + // More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets. + Image *string `field:"optional" json:"image" yaml:"image"` + // Image pull policy. + // + // One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + // Default: Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + // + ImagePullPolicy *string `field:"optional" json:"imagePullPolicy" yaml:"imagePullPolicy"` + // Actions that the management system should take in response to container lifecycle events. + // + // Cannot be updated. + Lifecycle *Lifecycle `field:"optional" json:"lifecycle" yaml:"lifecycle"` + // Periodic probe of container liveness. + // + // Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + LivenessProbe *Probe `field:"optional" json:"livenessProbe" yaml:"livenessProbe"` + // List of ports to expose from the container. + // + // Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Modifying this array with strategic merge patch may corrupt the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated. + Ports *[]*ContainerPort `field:"optional" json:"ports" yaml:"ports"` + // Periodic probe of container service readiness. + // + // Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + ReadinessProbe *Probe `field:"optional" json:"readinessProbe" yaml:"readinessProbe"` + // Compute Resources required by this container. + // + // Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + Resources *ResourceRequirements `field:"optional" json:"resources" yaml:"resources"` + // SecurityContext defines the security options the container should be run with. + // + // If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + SecurityContext *SecurityContext `field:"optional" json:"securityContext" yaml:"securityContext"` + // StartupProbe indicates that the Pod has successfully initialized. + // + // If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + StartupProbe *Probe `field:"optional" json:"startupProbe" yaml:"startupProbe"` + // Whether this container should allocate a buffer for stdin in the container runtime. + // + // If this is not set, reads from stdin in the container will always result in EOF. Default is false. + // Default: false. + // + Stdin *bool `field:"optional" json:"stdin" yaml:"stdin"` + // Whether the container runtime should close the stdin channel after it has been opened by a single attach. + // + // When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false + // Default: false. + // + StdinOnce *bool `field:"optional" json:"stdinOnce" yaml:"stdinOnce"` + // Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. + // + // Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated. + // Default: dev/termination-log. Cannot be updated. + // + TerminationMessagePath *string `field:"optional" json:"terminationMessagePath" yaml:"terminationMessagePath"` + // Indicate how the termination message should be populated. + // + // File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated. + // Default: File. Cannot be updated. + // + TerminationMessagePolicy *string `field:"optional" json:"terminationMessagePolicy" yaml:"terminationMessagePolicy"` + // Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. + // + // Default is false. + // Default: false. + // + Tty *bool `field:"optional" json:"tty" yaml:"tty"` + // volumeDevices is the list of block devices to be used by the container. + VolumeDevices *[]*VolumeDevice `field:"optional" json:"volumeDevices" yaml:"volumeDevices"` + // Pod volumes to mount into the container's filesystem. + // + // Cannot be updated. + VolumeMounts *[]*VolumeMount `field:"optional" json:"volumeMounts" yaml:"volumeMounts"` + // Container's working directory. + // + // If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated. + WorkingDir *string `field:"optional" json:"workingDir" yaml:"workingDir"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ContainerPort.go b/examples/cdk8s-sample-deployment/imports/k8s/ContainerPort.go new file mode 100644 index 0000000..98da3dc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ContainerPort.go @@ -0,0 +1,27 @@ +package k8s + + +// ContainerPort represents a network port in a single container. +type ContainerPort struct { + // Number of port to expose on the pod's IP address. + // + // This must be a valid port number, 0 < x < 65536. + ContainerPort *float64 `field:"required" json:"containerPort" yaml:"containerPort"` + // What host IP to bind the external port to. + HostIp *string `field:"optional" json:"hostIp" yaml:"hostIp"` + // Number of port to expose on the host. + // + // If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this. + HostPort *float64 `field:"optional" json:"hostPort" yaml:"hostPort"` + // If specified, this must be an IANA_SVC_NAME and unique within the pod. + // + // Each named port in a pod must have a unique name. Name for the port that can be referred to by services. + Name *string `field:"optional" json:"name" yaml:"name"` + // Protocol for port. + // + // Must be UDP, TCP, or SCTP. Defaults to "TCP". + // Default: TCP". + // + Protocol *string `field:"optional" json:"protocol" yaml:"protocol"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ContainerResourceMetricSourceV2.go b/examples/cdk8s-sample-deployment/imports/k8s/ContainerResourceMetricSourceV2.go new file mode 100644 index 0000000..db49cb3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ContainerResourceMetricSourceV2.go @@ -0,0 +1,13 @@ +package k8s + + +// ContainerResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. Only one "target" type should be set. +type ContainerResourceMetricSourceV2 struct { + // container is the name of the container in the pods of the scaling target. + Container *string `field:"required" json:"container" yaml:"container"` + // name is the name of the resource in question. + Name *string `field:"required" json:"name" yaml:"name"` + // target specifies the target value for the given metric. + Target *MetricTargetV2 `field:"required" json:"target" yaml:"target"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ContainerResourceMetricSourceV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/ContainerResourceMetricSourceV2Beta2.go new file mode 100644 index 0000000..4531ecf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ContainerResourceMetricSourceV2Beta2.go @@ -0,0 +1,13 @@ +package k8s + + +// ContainerResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. Only one "target" type should be set. +type ContainerResourceMetricSourceV2Beta2 struct { + // container is the name of the container in the pods of the scaling target. + Container *string `field:"required" json:"container" yaml:"container"` + // name is the name of the resource in question. + Name *string `field:"required" json:"name" yaml:"name"` + // target specifies the target value for the given metric. + Target *MetricTargetV2Beta2 `field:"required" json:"target" yaml:"target"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CronJobSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/CronJobSpec.go new file mode 100644 index 0000000..064bcda --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CronJobSpec.go @@ -0,0 +1,39 @@ +package k8s + + +// CronJobSpec describes how the job execution will look like and when it will actually run. +type CronJobSpec struct { + // Specifies the job that will be created when executing a CronJob. + JobTemplate *JobTemplateSpec `field:"required" json:"jobTemplate" yaml:"jobTemplate"` + // The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. + Schedule *string `field:"required" json:"schedule" yaml:"schedule"` + // Specifies how to treat concurrent executions of a Job. + // + // Valid values are: - "Allow" (default): allows CronJobs to run concurrently; - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet; - "Replace": cancels currently running job and replaces it with a new one. + ConcurrencyPolicy *string `field:"optional" json:"concurrencyPolicy" yaml:"concurrencyPolicy"` + // The number of failed finished jobs to retain. + // + // Value must be non-negative integer. Defaults to 1. + // Default: 1. + // + FailedJobsHistoryLimit *float64 `field:"optional" json:"failedJobsHistoryLimit" yaml:"failedJobsHistoryLimit"` + // Optional deadline in seconds for starting the job if it misses scheduled time for any reason. + // + // Missed jobs executions will be counted as failed ones. + StartingDeadlineSeconds *float64 `field:"optional" json:"startingDeadlineSeconds" yaml:"startingDeadlineSeconds"` + // The number of successful finished jobs to retain. + // + // Value must be non-negative integer. Defaults to 3. + // Default: 3. + // + SuccessfulJobsHistoryLimit *float64 `field:"optional" json:"successfulJobsHistoryLimit" yaml:"successfulJobsHistoryLimit"` + // This flag tells the controller to suspend subsequent executions, it does not apply to already started executions. + // + // Defaults to false. + // Default: false. + // + Suspend *bool `field:"optional" json:"suspend" yaml:"suspend"` + // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will default to the time zone of the kube-controller-manager process. The set of valid time zone names and the time zone offset is loaded from the system-wide time zone database by the API server during CronJob validation and the controller manager during execution. If no system-wide time zone database can be found a bundled version of the database is used instead. If the time zone name becomes invalid during the lifetime of a CronJob or due to a change in host configuration, the controller will stop creating new new Jobs and will create a system event with the reason UnknownTimeZone. More information can be found in https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zones This is beta field and must be enabled via the `CronJobTimeZone` feature gate. + TimeZone *string `field:"optional" json:"timeZone" yaml:"timeZone"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CrossVersionObjectReference.go b/examples/cdk8s-sample-deployment/imports/k8s/CrossVersionObjectReference.go new file mode 100644 index 0000000..a3518e1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CrossVersionObjectReference.go @@ -0,0 +1,17 @@ +package k8s + + +// CrossVersionObjectReference contains enough information to let you identify the referred resource. +type CrossVersionObjectReference struct { + // Kind of the referent; + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + Kind *string `field:"required" json:"kind" yaml:"kind"` + // Name of the referent; + // + // More info: http://kubernetes.io/docs/user-guide/identifiers#names + Name *string `field:"required" json:"name" yaml:"name"` + // API version of the referent. + ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CrossVersionObjectReferenceV2.go b/examples/cdk8s-sample-deployment/imports/k8s/CrossVersionObjectReferenceV2.go new file mode 100644 index 0000000..dfc2bd5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CrossVersionObjectReferenceV2.go @@ -0,0 +1,17 @@ +package k8s + + +// CrossVersionObjectReference contains enough information to let you identify the referred resource. +type CrossVersionObjectReferenceV2 struct { + // Kind of the referent; + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + Kind *string `field:"required" json:"kind" yaml:"kind"` + // Name of the referent; + // + // More info: http://kubernetes.io/docs/user-guide/identifiers#names + Name *string `field:"required" json:"name" yaml:"name"` + // API version of the referent. + ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CrossVersionObjectReferenceV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/CrossVersionObjectReferenceV2Beta2.go new file mode 100644 index 0000000..fa546fa --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CrossVersionObjectReferenceV2Beta2.go @@ -0,0 +1,17 @@ +package k8s + + +// CrossVersionObjectReference contains enough information to let you identify the referred resource. +type CrossVersionObjectReferenceV2Beta2 struct { + // Kind of the referent; + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + Kind *string `field:"required" json:"kind" yaml:"kind"` + // Name of the referent; + // + // More info: http://kubernetes.io/docs/user-guide/identifiers#names + Name *string `field:"required" json:"name" yaml:"name"` + // API version of the referent. + ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CsiDriverSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/CsiDriverSpec.go new file mode 100644 index 0000000..9c008c2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CsiDriverSpec.go @@ -0,0 +1,73 @@ +package k8s + + +// CSIDriverSpec is the specification of a CSIDriver. +type CsiDriverSpec struct { + // attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. + // + // The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the CSIDriverRegistry feature gate is enabled and the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called. + // + // This field is immutable. + AttachRequired *bool `field:"optional" json:"attachRequired" yaml:"attachRequired"` + // Defines if the underlying volume supports changing ownership and permission of the volume before being mounted. + // + // Refer to the specific FSGroupPolicy values for additional details. + // + // This field is immutable. + // + // Defaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce. + // Default: ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce. + // + FsGroupPolicy *string `field:"optional" json:"fsGroupPolicy" yaml:"fsGroupPolicy"` + // If set to true, podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations. If set to false, pod information will not be passed on mount. Default is false. The CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext. The following VolumeConext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. "csi.storage.k8s.io/pod.name": pod.Name "csi.storage.k8s.io/pod.namespace": pod.Namespace "csi.storage.k8s.io/pod.uid": string(pod.UID) "csi.storage.k8s.io/ephemeral": "true" if the volume is an ephemeral inline volume defined by a CSIVolumeSource, otherwise "false". + // + // "csi.storage.k8s.io/ephemeral" is a new feature in Kubernetes 1.16. It is only required for drivers which support both the "Persistent" and "Ephemeral" VolumeLifecycleMode. Other drivers can leave pod info disabled and/or ignore this field. As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when deployed on such a cluster and the deployment determines which mode that is, for example via a command line parameter of the driver. + // + // This field is immutable. + // Default: false. The CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext. The following VolumeConext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. "csi.storage.k8s.io/pod.name": pod.Name "csi.storage.k8s.io/pod.namespace": pod.Namespace "csi.storage.k8s.io/pod.uid": string(pod.UID) "csi.storage.k8s.io/ephemeral": "true" if the volume is an ephemeral inline volume + // + PodInfoOnMount *bool `field:"optional" json:"podInfoOnMount" yaml:"podInfoOnMount"` + // RequiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. + // + // This field defaults to false. + // + // Note: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container. + RequiresRepublish *bool `field:"optional" json:"requiresRepublish" yaml:"requiresRepublish"` + // SELinuxMount specifies if the CSI driver supports "-o context" mount option. + // + // When "true", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different `-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with "-o context=xyz" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context. + // + // When "false", Kubernetes won't pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem. + // + // Default is "false". + // Default: false". + // + SeLinuxMount *bool `field:"optional" json:"seLinuxMount" yaml:"seLinuxMount"` + // If set to true, storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information. + // + // The check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object. + // + // Alternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published. + // + // This field was immutable in Kubernetes <= 1.22 and now is mutable. + StorageCapacity *bool `field:"optional" json:"storageCapacity" yaml:"storageCapacity"` + // TokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. + // + // Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: "csi.storage.k8s.io/serviceAccount.tokens": { + // "": { + // "token": , + // "expirationTimestamp": , + // }, + // ... + // } + // + // Note: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically. + TokenRequests *[]*TokenRequest `field:"optional" json:"tokenRequests" yaml:"tokenRequests"` + // volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. + // + // The default if the list is empty is "Persistent", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. The other mode is "Ephemeral". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. For more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future. This field is beta. + // + // This field is immutable. + VolumeLifecycleModes *[]*string `field:"optional" json:"volumeLifecycleModes" yaml:"volumeLifecycleModes"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CsiNodeDriver.go b/examples/cdk8s-sample-deployment/imports/k8s/CsiNodeDriver.go new file mode 100644 index 0000000..5b2f707 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CsiNodeDriver.go @@ -0,0 +1,23 @@ +package k8s + + +// CSINodeDriver holds information about the specification of one CSI driver installed on a node. +type CsiNodeDriver struct { + // This is the name of the CSI driver that this object refers to. + // + // This MUST be the same name returned by the CSI GetPluginName() call for that driver. + Name *string `field:"required" json:"name" yaml:"name"` + // nodeID of the node from the driver point of view. + // + // This field enables Kubernetes to communicate with storage systems that do not share the same nomenclature for nodes. For example, Kubernetes may refer to a given node as "node1", but the storage system may refer to the same node as "nodeA". When Kubernetes issues a command to the storage system to attach a volume to a specific node, it can use this field to refer to the node name using the ID that the storage system will understand, e.g. "nodeA" instead of "node1". This field is required. + NodeId *string `field:"required" json:"nodeId" yaml:"nodeId"` + // allocatable represents the volume resources of a node that are available for scheduling. + // + // This field is beta. + Allocatable *VolumeNodeResources `field:"optional" json:"allocatable" yaml:"allocatable"` + // topologyKeys is the list of keys supported by the driver. + // + // When a driver is initialized on a cluster, it provides a set of topology keys that it understands (e.g. "company.com/zone", "company.com/region"). When a driver is initialized on a node, it provides the same topology keys along with values. Kubelet will expose these topology keys as labels on its own node object. When Kubernetes does topology aware provisioning, it can use this list to determine which labels it should retrieve from the node object and pass back to the driver. It is possible for different nodes to use different topology keys. This can be empty if driver does not support topology. + TopologyKeys *[]*string `field:"optional" json:"topologyKeys" yaml:"topologyKeys"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CsiNodeSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/CsiNodeSpec.go new file mode 100644 index 0000000..73f35e4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CsiNodeSpec.go @@ -0,0 +1,11 @@ +package k8s + + +// CSINodeSpec holds information about the specification of all CSI drivers installed on a node. +type CsiNodeSpec struct { + // drivers is a list of information of all CSI Drivers existing on a node. + // + // If all drivers in the list are uninstalled, this can become empty. + Drivers *[]*CsiNodeDriver `field:"required" json:"drivers" yaml:"drivers"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CsiPersistentVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/CsiPersistentVolumeSource.go new file mode 100644 index 0000000..9a183a9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CsiPersistentVolumeSource.go @@ -0,0 +1,47 @@ +package k8s + + +// Represents storage that is managed by an external CSI volume driver (Beta feature). +type CsiPersistentVolumeSource struct { + // driver is the name of the driver to use for this volume. + // + // Required. + Driver *string `field:"required" json:"driver" yaml:"driver"` + // volumeHandle is the unique volume name returned by the CSI volume plugin’s CreateVolume to refer to the volume on all subsequent calls. + // + // Required. + VolumeHandle *string `field:"required" json:"volumeHandle" yaml:"volumeHandle"` + // controllerExpandSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI ControllerExpandVolume call. + // + // This is an beta field and requires enabling ExpandCSIVolumes feature gate. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed. + ControllerExpandSecretRef *SecretReference `field:"optional" json:"controllerExpandSecretRef" yaml:"controllerExpandSecretRef"` + // controllerPublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI ControllerPublishVolume and ControllerUnpublishVolume calls. + // + // This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed. + ControllerPublishSecretRef *SecretReference `field:"optional" json:"controllerPublishSecretRef" yaml:"controllerPublishSecretRef"` + // fsType to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // nodeExpandSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodeExpandVolume call. + // + // This is an alpha field and requires enabling CSINodeExpandSecret feature gate. This field is optional, may be omitted if no secret is required. If the secret object contains more than one secret, all secrets are passed. + NodeExpandSecretRef *SecretReference `field:"optional" json:"nodeExpandSecretRef" yaml:"nodeExpandSecretRef"` + // nodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. + // + // This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed. + NodePublishSecretRef *SecretReference `field:"optional" json:"nodePublishSecretRef" yaml:"nodePublishSecretRef"` + // nodeStageSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodeStageVolume and NodeStageVolume and NodeUnstageVolume calls. + // + // This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed. + NodeStageSecretRef *SecretReference `field:"optional" json:"nodeStageSecretRef" yaml:"nodeStageSecretRef"` + // readOnly value to pass to ControllerPublishVolumeRequest. + // + // Defaults to false (read/write). + // Default: false (read/write). + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // volumeAttributes of the volume to publish. + VolumeAttributes *map[string]*string `field:"optional" json:"volumeAttributes" yaml:"volumeAttributes"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CsiVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/CsiVolumeSource.go new file mode 100644 index 0000000..3e35920 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CsiVolumeSource.go @@ -0,0 +1,29 @@ +package k8s + + +// Represents a source location of a volume to mount, managed by an external CSI driver. +type CsiVolumeSource struct { + // driver is the name of the CSI driver that handles this volume. + // + // Consult with your admin for the correct name as registered in the cluster. + Driver *string `field:"required" json:"driver" yaml:"driver"` + // fsType to mount. + // + // Ex. "ext4", "xfs", "ntfs". If not provided, the empty value is passed to the associated CSI driver which will determine the default filesystem to apply. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // nodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. + // + // This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secret references are passed. + NodePublishSecretRef *LocalObjectReference `field:"optional" json:"nodePublishSecretRef" yaml:"nodePublishSecretRef"` + // readOnly specifies a read-only configuration for the volume. + // + // Defaults to false (read/write). + // Default: false (read/write). + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // volumeAttributes stores driver-specific properties that are passed to the CSI driver. + // + // Consult your driver's documentation for supported values. + VolumeAttributes *map[string]*string `field:"optional" json:"volumeAttributes" yaml:"volumeAttributes"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceColumnDefinition.go b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceColumnDefinition.go new file mode 100644 index 0000000..17a8b32 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceColumnDefinition.go @@ -0,0 +1,25 @@ +package k8s + + +// CustomResourceColumnDefinition specifies a column for server side printing. +type CustomResourceColumnDefinition struct { + // jsonPath is a simple JSON path (i.e. with array notation) which is evaluated against each custom resource to produce the value for this column. + JsonPath *string `field:"required" json:"jsonPath" yaml:"jsonPath"` + // name is a human readable name for the column. + Name *string `field:"required" json:"name" yaml:"name"` + // type is an OpenAPI type definition for this column. + // + // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + Type *string `field:"required" json:"type" yaml:"type"` + // description is a human readable description of this column. + Description *string `field:"optional" json:"description" yaml:"description"` + // format is an optional OpenAPI type definition for this column. + // + // The 'name' format is applied to the primary identifier column to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + Format *string `field:"optional" json:"format" yaml:"format"` + // priority is an integer defining the relative importance of this column compared to others. + // + // Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a priority greater than 0. + Priority *float64 `field:"optional" json:"priority" yaml:"priority"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceConversion.go b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceConversion.go new file mode 100644 index 0000000..c325f4a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceConversion.go @@ -0,0 +1,16 @@ +package k8s + + +// CustomResourceConversion describes how to convert different versions of a CR. +type CustomResourceConversion struct { + // strategy specifies how custom resources are converted between versions. + // + // Allowed values are: - `None`: The converter only change the apiVersion and would not touch any other field in the custom resource. - `Webhook`: API Server will call to an external webhook to do the conversion. Additional information + // is needed for this option. This requires spec.preserveUnknownFields to be false, and spec.conversion.webhook to be set. + Strategy *string `field:"required" json:"strategy" yaml:"strategy"` + // webhook describes how to call the conversion webhook. + // + // Required when `strategy` is set to `Webhook`. + Webhook *WebhookConversion `field:"optional" json:"webhook" yaml:"webhook"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceDefinitionNames.go b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceDefinitionNames.go new file mode 100644 index 0000000..c73d917 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceDefinitionNames.go @@ -0,0 +1,33 @@ +package k8s + + +// CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition. +type CustomResourceDefinitionNames struct { + // kind is the serialized kind of the resource. + // + // It is normally CamelCase and singular. Custom resource instances will use this value as the `kind` attribute in API calls. + Kind *string `field:"required" json:"kind" yaml:"kind"` + // plural is the plural name of the resource to serve. + // + // The custom resources are served under `/apis///.../`. Must match the name of the CustomResourceDefinition (in the form `.`). Must be all lowercase. + Plural *string `field:"required" json:"plural" yaml:"plural"` + // categories is a list of grouped resources this custom resource belongs to (e.g. 'all'). This is published in API discovery documents, and used by clients to support invocations like `kubectl get all`. + Categories *[]*string `field:"optional" json:"categories" yaml:"categories"` + // listKind is the serialized kind of the list for this resource. + // + // Defaults to "`kind`List". + // Default: kind`List". + // + ListKind *string `field:"optional" json:"listKind" yaml:"listKind"` + // shortNames are short names for the resource, exposed in API discovery documents, and used by clients to support invocations like `kubectl get `. + // + // It must be all lowercase. + ShortNames *[]*string `field:"optional" json:"shortNames" yaml:"shortNames"` + // singular is the singular name of the resource. + // + // It must be all lowercase. Defaults to lowercased `kind`. + // Default: lowercased `kind`. + // + Singular *string `field:"optional" json:"singular" yaml:"singular"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceDefinitionSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceDefinitionSpec.go new file mode 100644 index 0000000..0e94993 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceDefinitionSpec.go @@ -0,0 +1,27 @@ +package k8s + + +// CustomResourceDefinitionSpec describes how a user wants their resource to appear. +type CustomResourceDefinitionSpec struct { + // group is the API group of the defined custom resource. + // + // The custom resources are served under `/apis//...`. Must match the name of the CustomResourceDefinition (in the form `.`). + Group *string `field:"required" json:"group" yaml:"group"` + // names specify the resource and kind names for the custom resource. + Names *CustomResourceDefinitionNames `field:"required" json:"names" yaml:"names"` + // scope indicates whether the defined custom resource is cluster- or namespace-scoped. + // + // Allowed values are `Cluster` and `Namespaced`. + Scope *string `field:"required" json:"scope" yaml:"scope"` + // versions is the list of all API versions of the defined custom resource. + // + // Version names are used to compute the order in which served versions are listed in API discovery. If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10. + Versions *[]*CustomResourceDefinitionVersion `field:"required" json:"versions" yaml:"versions"` + // conversion defines conversion settings for the CRD. + Conversion *CustomResourceConversion `field:"optional" json:"conversion" yaml:"conversion"` + // preserveUnknownFields indicates that object fields which are not specified in the OpenAPI schema should be preserved when persisting to storage. + // + // apiVersion, kind, metadata and known fields inside metadata are always preserved. This field is deprecated in favor of setting `x-preserve-unknown-fields` to true in `spec.versions[*].schema.openAPIV3Schema`. See https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#pruning-versus-preserving-unknown-fields for details. + PreserveUnknownFields *bool `field:"optional" json:"preserveUnknownFields" yaml:"preserveUnknownFields"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceDefinitionVersion.go b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceDefinitionVersion.go new file mode 100644 index 0000000..f128da9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceDefinitionVersion.go @@ -0,0 +1,33 @@ +package k8s + + +// CustomResourceDefinitionVersion describes a version for CRD. +type CustomResourceDefinitionVersion struct { + // name is the version name, e.g. “v1”, “v2beta1”, etc. The custom resources are served under this version at `/apis///...` if `served` is true. + Name *string `field:"required" json:"name" yaml:"name"` + // served is a flag enabling/disabling this version from being served via REST APIs. + Served *bool `field:"required" json:"served" yaml:"served"` + // storage indicates this version should be used when persisting custom resources to storage. + // + // There must be exactly one version with storage=true. + Storage *bool `field:"required" json:"storage" yaml:"storage"` + // additionalPrinterColumns specifies additional columns returned in Table output. + // + // See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for details. If no columns are specified, a single column displaying the age of the custom resource is used. + AdditionalPrinterColumns *[]*CustomResourceColumnDefinition `field:"optional" json:"additionalPrinterColumns" yaml:"additionalPrinterColumns"` + // deprecated indicates this version of the custom resource API is deprecated. + // + // When set to true, API requests to this version receive a warning header in the server response. Defaults to false. + // Default: false. + // + Deprecated *bool `field:"optional" json:"deprecated" yaml:"deprecated"` + // deprecationWarning overrides the default warning returned to API clients. + // + // May only be set when `deprecated` is true. The default warning indicates this version is deprecated and recommends use of the newest served version of equal or greater stability, if one exists. + DeprecationWarning *string `field:"optional" json:"deprecationWarning" yaml:"deprecationWarning"` + // schema describes the schema used for validation, pruning, and defaulting of this version of the custom resource. + Schema *CustomResourceValidation `field:"optional" json:"schema" yaml:"schema"` + // subresources specify what subresources this version of the defined custom resource have. + Subresources *CustomResourceSubresources `field:"optional" json:"subresources" yaml:"subresources"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceSubresourceScale.go b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceSubresourceScale.go new file mode 100644 index 0000000..61e2661 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceSubresourceScale.go @@ -0,0 +1,13 @@ +package k8s + + +// CustomResourceSubresourceScale defines how to serve the scale subresource for CustomResources. +type CustomResourceSubresourceScale struct { + // specReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `spec.replicas`. Only JSON paths without the array notation are allowed. Must be a JSON Path under `.spec`. If there is no value under the given path in the custom resource, the `/scale` subresource will return an error on GET. + SpecReplicasPath *string `field:"required" json:"specReplicasPath" yaml:"specReplicasPath"` + // statusReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `status.replicas`. Only JSON paths without the array notation are allowed. Must be a JSON Path under `.status`. If there is no value under the given path in the custom resource, the `status.replicas` value in the `/scale` subresource will default to 0. + StatusReplicasPath *string `field:"required" json:"statusReplicasPath" yaml:"statusReplicasPath"` + // labelSelectorPath defines the JSON path inside of a custom resource that corresponds to Scale `status.selector`. Only JSON paths without the array notation are allowed. Must be a JSON Path under `.status` or `.spec`. Must be set to work with HorizontalPodAutoscaler. The field pointed by this JSON path must be a string field (not a complex selector struct) which contains a serialized label selector in string form. More info: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions#scale-subresource If there is no value under the given path in the custom resource, the `status.selector` value in the `/scale` subresource will default to the empty string. + LabelSelectorPath *string `field:"optional" json:"labelSelectorPath" yaml:"labelSelectorPath"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceSubresources.go b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceSubresources.go new file mode 100644 index 0000000..b591944 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceSubresources.go @@ -0,0 +1,13 @@ +package k8s + + +// CustomResourceSubresources defines the status and scale subresources for CustomResources. +type CustomResourceSubresources struct { + // scale indicates the custom resource should serve a `/scale` subresource that returns an `autoscaling/v1` Scale object. + Scale *CustomResourceSubresourceScale `field:"optional" json:"scale" yaml:"scale"` + // status indicates the custom resource should serve a `/status` subresource. + // + // When enabled: 1. requests to the custom resource primary endpoint ignore changes to the `status` stanza of the object. 2. requests to the custom resource `/status` subresource ignore changes to anything other than the `status` stanza of the object. + Status interface{} `field:"optional" json:"status" yaml:"status"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceValidation.go b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceValidation.go new file mode 100644 index 0000000..6297a04 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/CustomResourceValidation.go @@ -0,0 +1,9 @@ +package k8s + + +// CustomResourceValidation is a list of validation methods for CustomResources. +type CustomResourceValidation struct { + // openAPIV3Schema is the OpenAPI v3 schema to use for validation and pruning. + OpenApiv3Schema *JsonSchemaProps `field:"optional" json:"openApiv3Schema" yaml:"openApiv3Schema"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/DaemonSetSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/DaemonSetSpec.go new file mode 100644 index 0000000..a404913 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/DaemonSetSpec.go @@ -0,0 +1,29 @@ +package k8s + + +// DaemonSetSpec is the specification of a daemon set. +type DaemonSetSpec struct { + // A label query over pods that are managed by the daemon set. + // + // Must match in order to be controlled. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector *LabelSelector `field:"required" json:"selector" yaml:"selector"` + // An object that describes the pod that will be created. + // + // The DaemonSet will create exactly one copy of this pod on every node that matches the template's node selector (or on every node if no node selector is specified). More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + Template *PodTemplateSpec `field:"required" json:"template" yaml:"template"` + // The minimum number of seconds for which a newly created DaemonSet pod should be ready without any of its container crashing, for it to be considered available. + // + // Defaults to 0 (pod will be considered available as soon as it is ready). + // Default: 0 (pod will be considered available as soon as it is ready). + // + MinReadySeconds *float64 `field:"optional" json:"minReadySeconds" yaml:"minReadySeconds"` + // The number of old history to retain to allow rollback. + // + // This is a pointer to distinguish between explicit zero and not specified. Defaults to 10. + // Default: 10. + // + RevisionHistoryLimit *float64 `field:"optional" json:"revisionHistoryLimit" yaml:"revisionHistoryLimit"` + // An update strategy to replace existing DaemonSet pods with new pods. + UpdateStrategy *DaemonSetUpdateStrategy `field:"optional" json:"updateStrategy" yaml:"updateStrategy"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/DaemonSetUpdateStrategy.go b/examples/cdk8s-sample-deployment/imports/k8s/DaemonSetUpdateStrategy.go new file mode 100644 index 0000000..202cbe1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/DaemonSetUpdateStrategy.go @@ -0,0 +1,17 @@ +package k8s + + +// DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet. +type DaemonSetUpdateStrategy struct { + // Rolling update config params. + // + // Present only if type = "RollingUpdate". + RollingUpdate *RollingUpdateDaemonSet `field:"optional" json:"rollingUpdate" yaml:"rollingUpdate"` + // Type of daemon set update. + // + // Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate. + // Default: RollingUpdate. + // + Type *string `field:"optional" json:"type" yaml:"type"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/DeleteOptions.go b/examples/cdk8s-sample-deployment/imports/k8s/DeleteOptions.go new file mode 100644 index 0000000..7b50aae --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/DeleteOptions.go @@ -0,0 +1,35 @@ +package k8s + + +// DeleteOptions may be provided when deleting an API object. +type DeleteOptions struct { + // 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 + ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"` + // When present, indicates that modifications should not be persisted. + // + // An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed + DryRun *[]*string `field:"optional" json:"dryRun" yaml:"dryRun"` + // The duration in seconds before the object should be deleted. + // + // Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. + // Default: a per object value if not specified. zero means delete immediately. + // + GracePeriodSeconds *float64 `field:"optional" json:"gracePeriodSeconds" yaml:"gracePeriodSeconds"` + // 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 + Kind IoK8SApimachineryPkgApisMetaV1DeleteOptionsKind `field:"optional" json:"kind" yaml:"kind"` + // Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. + OrphanDependents *bool `field:"optional" json:"orphanDependents" yaml:"orphanDependents"` + // Must be fulfilled before a deletion is carried out. + // + // If not possible, a 409 Conflict status will be returned. + Preconditions *Preconditions `field:"optional" json:"preconditions" yaml:"preconditions"` + // Whether and how garbage collection will be performed. + // + // Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. + PropagationPolicy *string `field:"optional" json:"propagationPolicy" yaml:"propagationPolicy"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/DeploymentSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/DeploymentSpec.go new file mode 100644 index 0000000..d7293d0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/DeploymentSpec.go @@ -0,0 +1,41 @@ +package k8s + + +// DeploymentSpec is the specification of the desired behavior of the Deployment. +type DeploymentSpec struct { + // Label selector for pods. + // + // Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels. + Selector *LabelSelector `field:"required" json:"selector" yaml:"selector"` + // Template describes the pods that will be created. + Template *PodTemplateSpec `field:"required" json:"template" yaml:"template"` + // Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. + // + // Defaults to 0 (pod will be considered available as soon as it is ready). + // Default: 0 (pod will be considered available as soon as it is ready). + // + MinReadySeconds *float64 `field:"optional" json:"minReadySeconds" yaml:"minReadySeconds"` + // Indicates that the deployment is paused. + Paused *bool `field:"optional" json:"paused" yaml:"paused"` + // The maximum time in seconds for a deployment to make progress before it is considered to be failed. + // + // The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that progress will not be estimated during the time a deployment is paused. Defaults to 600s. + // Default: 600s. + // + ProgressDeadlineSeconds *float64 `field:"optional" json:"progressDeadlineSeconds" yaml:"progressDeadlineSeconds"` + // Number of desired pods. + // + // This is a pointer to distinguish between explicit zero and not specified. Defaults to 1. + // Default: 1. + // + Replicas *float64 `field:"optional" json:"replicas" yaml:"replicas"` + // The number of old ReplicaSets to retain to allow rollback. + // + // This is a pointer to distinguish between explicit zero and not specified. Defaults to 10. + // Default: 10. + // + RevisionHistoryLimit *float64 `field:"optional" json:"revisionHistoryLimit" yaml:"revisionHistoryLimit"` + // The deployment strategy to use to replace existing pods with new ones. + Strategy *DeploymentStrategy `field:"optional" json:"strategy" yaml:"strategy"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/DeploymentStrategy.go b/examples/cdk8s-sample-deployment/imports/k8s/DeploymentStrategy.go new file mode 100644 index 0000000..1c33702 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/DeploymentStrategy.go @@ -0,0 +1,17 @@ +package k8s + + +// DeploymentStrategy describes how to replace existing pods with new ones. +type DeploymentStrategy struct { + // Rolling update config params. + // + // Present only if DeploymentStrategyType = RollingUpdate. + RollingUpdate *RollingUpdateDeployment `field:"optional" json:"rollingUpdate" yaml:"rollingUpdate"` + // Type of deployment. + // + // Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. + // Default: RollingUpdate. + // + Type *string `field:"optional" json:"type" yaml:"type"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/DownwardApiProjection.go b/examples/cdk8s-sample-deployment/imports/k8s/DownwardApiProjection.go new file mode 100644 index 0000000..6448c6b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/DownwardApiProjection.go @@ -0,0 +1,11 @@ +package k8s + + +// Represents downward API info for projecting into a projected volume. +// +// Note that this is identical to a downwardAPI volume source without the default mode. +type DownwardApiProjection struct { + // Items is a list of DownwardAPIVolume file. + Items *[]*DownwardApiVolumeFile `field:"optional" json:"items" yaml:"items"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/DownwardApiVolumeFile.go b/examples/cdk8s-sample-deployment/imports/k8s/DownwardApiVolumeFile.go new file mode 100644 index 0000000..65917a5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/DownwardApiVolumeFile.go @@ -0,0 +1,19 @@ +package k8s + + +// DownwardAPIVolumeFile represents information to create the file containing the pod field. +type DownwardApiVolumeFile struct { + // Required: Path is the relative path name of the file to be created. + // + // Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..' + Path *string `field:"required" json:"path" yaml:"path"` + // Required: Selects a field of the pod: only annotations, labels, name and namespace are supported. + FieldRef *ObjectFieldSelector `field:"optional" json:"fieldRef" yaml:"fieldRef"` + // Optional: mode bits used to set permissions on this file, must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + // + // YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + Mode *float64 `field:"optional" json:"mode" yaml:"mode"` + // Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + ResourceFieldRef *ResourceFieldSelector `field:"optional" json:"resourceFieldRef" yaml:"resourceFieldRef"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/DownwardApiVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/DownwardApiVolumeSource.go new file mode 100644 index 0000000..4790b5b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/DownwardApiVolumeSource.go @@ -0,0 +1,17 @@ +package k8s + + +// DownwardAPIVolumeSource represents a volume containing downward API info. +// +// Downward API volumes support ownership management and SELinux relabeling. +type DownwardApiVolumeSource struct { + // Optional: mode bits to use on created files by default. + // + // Must be a Optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + // Default: 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + // + DefaultMode *float64 `field:"optional" json:"defaultMode" yaml:"defaultMode"` + // Items is a list of downward API volume file. + Items *[]*DownwardApiVolumeFile `field:"optional" json:"items" yaml:"items"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EmptyDirVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/EmptyDirVolumeSource.go new file mode 100644 index 0000000..33def1e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EmptyDirVolumeSource.go @@ -0,0 +1,17 @@ +package k8s + + +// Represents an empty directory for a pod. +// +// Empty directory volumes support ownership management and SELinux relabeling. +type EmptyDirVolumeSource struct { + // medium represents what type of storage medium should back this directory. + // + // The default is "" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + Medium *string `field:"optional" json:"medium" yaml:"medium"` + // sizeLimit is the total amount of local storage required for this EmptyDir volume. + // + // The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir + SizeLimit Quantity `field:"optional" json:"sizeLimit" yaml:"sizeLimit"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Endpoint.go b/examples/cdk8s-sample-deployment/imports/k8s/Endpoint.go new file mode 100644 index 0000000..8e13f3c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Endpoint.go @@ -0,0 +1,31 @@ +package k8s + + +// Endpoint represents a single logical "backend" implementing a service. +type Endpoint struct { + // addresses of this endpoint. + // + // The contents of this field are interpreted according to the corresponding EndpointSlice addressType field. Consumers must handle different types of addresses in the context of their own capabilities. This must contain at least one address but no more than 100. These are all assumed to be fungible and clients may choose to only use the first element. Refer to: https://issue.k8s.io/106267 + Addresses *[]*string `field:"required" json:"addresses" yaml:"addresses"` + // conditions contains information about the current status of the endpoint. + Conditions *EndpointConditions `field:"optional" json:"conditions" yaml:"conditions"` + // deprecatedTopology contains topology information part of the v1beta1 API. + // + // This field is deprecated, and will be removed when the v1beta1 API is removed (no sooner than kubernetes v1.24). While this field can hold values, it is not writable through the v1 API, and any attempts to write to it will be silently ignored. Topology information can be found in the zone and nodeName fields instead. + DeprecatedTopology *map[string]*string `field:"optional" json:"deprecatedTopology" yaml:"deprecatedTopology"` + // hints contains information associated with how an endpoint should be consumed. + Hints *EndpointHints `field:"optional" json:"hints" yaml:"hints"` + // hostname of this endpoint. + // + // This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS Label (RFC 1123) validation. + Hostname *string `field:"optional" json:"hostname" yaml:"hostname"` + // nodeName represents the name of the Node hosting this endpoint. + // + // This can be used to determine endpoints local to a Node. + NodeName *string `field:"optional" json:"nodeName" yaml:"nodeName"` + // targetRef is a reference to a Kubernetes object that represents this endpoint. + TargetRef *ObjectReference `field:"optional" json:"targetRef" yaml:"targetRef"` + // zone is the name of the Zone this endpoint exists in. + Zone *string `field:"optional" json:"zone" yaml:"zone"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EndpointAddress.go b/examples/cdk8s-sample-deployment/imports/k8s/EndpointAddress.go new file mode 100644 index 0000000..612caea --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EndpointAddress.go @@ -0,0 +1,19 @@ +package k8s + + +// EndpointAddress is a tuple that describes single IP address. +type EndpointAddress struct { + // The IP of this endpoint. + // + // May not be loopback (127.0.0.0/8), link-local (169.254.0.0/16), or link-local multicast ((224.0.0.0/24). IPv6 is also accepted but not fully supported on all platforms. Also, certain kubernetes components, like kube-proxy, are not IPv6 ready. + Ip *string `field:"required" json:"ip" yaml:"ip"` + // The Hostname of this endpoint. + Hostname *string `field:"optional" json:"hostname" yaml:"hostname"` + // Optional: Node hosting this endpoint. + // + // This can be used to determine endpoints local to a node. + NodeName *string `field:"optional" json:"nodeName" yaml:"nodeName"` + // Reference to object providing the endpoint. + TargetRef *ObjectReference `field:"optional" json:"targetRef" yaml:"targetRef"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EndpointConditions.go b/examples/cdk8s-sample-deployment/imports/k8s/EndpointConditions.go new file mode 100644 index 0000000..3e98565 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EndpointConditions.go @@ -0,0 +1,19 @@ +package k8s + + +// EndpointConditions represents the current condition of an endpoint. +type EndpointConditions struct { + // ready indicates that this endpoint is prepared to receive traffic, according to whatever system is managing the endpoint. + // + // A nil value indicates an unknown state. In most cases consumers should interpret this unknown state as ready. For compatibility reasons, ready should never be "true" for terminating endpoints. + Ready *bool `field:"optional" json:"ready" yaml:"ready"` + // serving is identical to ready except that it is set regardless of the terminating state of endpoints. + // + // This condition should be set to true for a ready endpoint that is terminating. If nil, consumers should defer to the ready condition. This field can be enabled with the EndpointSliceTerminatingCondition feature gate. + Serving *bool `field:"optional" json:"serving" yaml:"serving"` + // terminating indicates that this endpoint is terminating. + // + // A nil value indicates an unknown state. Consumers should interpret this unknown state to mean that the endpoint is not terminating. This field can be enabled with the EndpointSliceTerminatingCondition feature gate. + Terminating *bool `field:"optional" json:"terminating" yaml:"terminating"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EndpointHints.go b/examples/cdk8s-sample-deployment/imports/k8s/EndpointHints.go new file mode 100644 index 0000000..99b3f41 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EndpointHints.go @@ -0,0 +1,9 @@ +package k8s + + +// EndpointHints provides hints describing how an endpoint should be consumed. +type EndpointHints struct { + // forZones indicates the zone(s) this endpoint should be consumed by to enable topology aware routing. + ForZones *[]*ForZone `field:"optional" json:"forZones" yaml:"forZones"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EndpointPort.go b/examples/cdk8s-sample-deployment/imports/k8s/EndpointPort.go new file mode 100644 index 0000000..36e4400 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EndpointPort.go @@ -0,0 +1,23 @@ +package k8s + + +// EndpointPort is a tuple that describes a single port. +type EndpointPort struct { + // The port number of the endpoint. + Port *float64 `field:"required" json:"port" yaml:"port"` + // The application protocol for this port. + // + // This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names such as mycompany.com/my-custom-protocol. + AppProtocol *string `field:"optional" json:"appProtocol" yaml:"appProtocol"` + // The name of this port. + // + // This must match the 'name' field in the corresponding ServicePort. Must be a DNS_LABEL. Optional only if one port is defined. + Name *string `field:"optional" json:"name" yaml:"name"` + // The IP protocol for this port. + // + // Must be UDP, TCP, or SCTP. Default is TCP. + // Default: TCP. + // + Protocol *string `field:"optional" json:"protocol" yaml:"protocol"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EndpointSubset.go b/examples/cdk8s-sample-deployment/imports/k8s/EndpointSubset.go new file mode 100644 index 0000000..38f153b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EndpointSubset.go @@ -0,0 +1,27 @@ +package k8s + + +// EndpointSubset is a group of addresses with a common set of ports. +// +// The expanded set of endpoints is the Cartesian product of Addresses x Ports. For example, given: +// +// { +// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], +// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] +// } +// +// The resulting set of endpoints can be viewed as: +// +// a: [ 10.10.1.1:8675, 10.10.2.2:8675 ], +// b: [ 10.10.1.1:309, 10.10.2.2:309 ] +type EndpointSubset struct { + // IP addresses which offer the related ports that are marked as ready. + // + // These endpoints should be considered safe for load balancers and clients to utilize. + Addresses *[]*EndpointAddress `field:"optional" json:"addresses" yaml:"addresses"` + // IP addresses which offer the related ports but are not currently marked as ready because they have not yet finished starting, have recently failed a readiness check, or have recently failed a liveness check. + NotReadyAddresses *[]*EndpointAddress `field:"optional" json:"notReadyAddresses" yaml:"notReadyAddresses"` + // Port numbers available on the related IP addresses. + Ports *[]*EndpointPort `field:"optional" json:"ports" yaml:"ports"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EnvFromSource.go b/examples/cdk8s-sample-deployment/imports/k8s/EnvFromSource.go new file mode 100644 index 0000000..2dfd01e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EnvFromSource.go @@ -0,0 +1,15 @@ +package k8s + + +// EnvFromSource represents the source of a set of ConfigMaps. +type EnvFromSource struct { + // The ConfigMap to select from. + ConfigMapRef *ConfigMapEnvSource `field:"optional" json:"configMapRef" yaml:"configMapRef"` + // An optional identifier to prepend to each key in the ConfigMap. + // + // Must be a C_IDENTIFIER. + Prefix *string `field:"optional" json:"prefix" yaml:"prefix"` + // The Secret to select from. + SecretRef *SecretEnvSource `field:"optional" json:"secretRef" yaml:"secretRef"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EnvVar.go b/examples/cdk8s-sample-deployment/imports/k8s/EnvVar.go new file mode 100644 index 0000000..e35720e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EnvVar.go @@ -0,0 +1,21 @@ +package k8s + + +// EnvVar represents an environment variable present in a Container. +type EnvVar struct { + // Name of the environment variable. + // + // Must be a C_IDENTIFIER. + Name *string `field:"required" json:"name" yaml:"name"` + // Variable references $(VAR_NAME) are expanded using the previously defined environment variables in the container and any service environment variables. + // + // If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "". + // Default: . + // + Value *string `field:"optional" json:"value" yaml:"value"` + // Source for the environment variable's value. + // + // Cannot be used if value is not empty. + ValueFrom *EnvVarSource `field:"optional" json:"valueFrom" yaml:"valueFrom"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EnvVarSource.go b/examples/cdk8s-sample-deployment/imports/k8s/EnvVarSource.go new file mode 100644 index 0000000..8995ac2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EnvVarSource.go @@ -0,0 +1,15 @@ +package k8s + + +// EnvVarSource represents a source for the value of an EnvVar. +type EnvVarSource struct { + // Selects a key of a ConfigMap. + ConfigMapKeyRef *ConfigMapKeySelector `field:"optional" json:"configMapKeyRef" yaml:"configMapKeyRef"` + // Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. + FieldRef *ObjectFieldSelector `field:"optional" json:"fieldRef" yaml:"fieldRef"` + // Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. + ResourceFieldRef *ResourceFieldSelector `field:"optional" json:"resourceFieldRef" yaml:"resourceFieldRef"` + // Selects a key of a secret in the pod's namespace. + SecretKeyRef *SecretKeySelector `field:"optional" json:"secretKeyRef" yaml:"secretKeyRef"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EphemeralContainer.go b/examples/cdk8s-sample-deployment/imports/k8s/EphemeralContainer.go new file mode 100644 index 0000000..34e6922 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EphemeralContainer.go @@ -0,0 +1,105 @@ +package k8s + + +// An EphemeralContainer is a temporary container that you may add to an existing Pod for user-initiated activities such as debugging. +// +// Ephemeral containers have no resource or scheduling guarantees, and they will not be restarted when they exit or when a Pod is removed or restarted. The kubelet may evict a Pod if an ephemeral container causes the Pod to exceed its resource allocation. +// +// To add an ephemeral container, use the ephemeralcontainers subresource of an existing Pod. Ephemeral containers may not be removed or restarted. +type EphemeralContainer struct { + // Name of the ephemeral container specified as a DNS_LABEL. + // + // This name must be unique among all containers, init containers and ephemeral containers. + Name *string `field:"required" json:"name" yaml:"name"` + // Arguments to the entrypoint. + // + // The image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + Args *[]*string `field:"optional" json:"args" yaml:"args"` + // Entrypoint array. + // + // Not executed within a shell. The image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + Command *[]*string `field:"optional" json:"command" yaml:"command"` + // List of environment variables to set in the container. + // + // Cannot be updated. + Env *[]*EnvVar `field:"optional" json:"env" yaml:"env"` + // List of sources to populate environment variables in the container. + // + // The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated. + EnvFrom *[]*EnvFromSource `field:"optional" json:"envFrom" yaml:"envFrom"` + // Container image name. + // + // More info: https://kubernetes.io/docs/concepts/containers/images + Image *string `field:"optional" json:"image" yaml:"image"` + // Image pull policy. + // + // One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + // Default: Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + // + ImagePullPolicy *string `field:"optional" json:"imagePullPolicy" yaml:"imagePullPolicy"` + // Lifecycle is not allowed for ephemeral containers. + Lifecycle *Lifecycle `field:"optional" json:"lifecycle" yaml:"lifecycle"` + // Probes are not allowed for ephemeral containers. + LivenessProbe *Probe `field:"optional" json:"livenessProbe" yaml:"livenessProbe"` + // Ports are not allowed for ephemeral containers. + Ports *[]*ContainerPort `field:"optional" json:"ports" yaml:"ports"` + // Probes are not allowed for ephemeral containers. + ReadinessProbe *Probe `field:"optional" json:"readinessProbe" yaml:"readinessProbe"` + // Resources are not allowed for ephemeral containers. + // + // Ephemeral containers use spare resources already allocated to the pod. + Resources *ResourceRequirements `field:"optional" json:"resources" yaml:"resources"` + // Optional: SecurityContext defines the security options the ephemeral container should be run with. + // + // If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. + SecurityContext *SecurityContext `field:"optional" json:"securityContext" yaml:"securityContext"` + // Probes are not allowed for ephemeral containers. + StartupProbe *Probe `field:"optional" json:"startupProbe" yaml:"startupProbe"` + // Whether this container should allocate a buffer for stdin in the container runtime. + // + // If this is not set, reads from stdin in the container will always result in EOF. Default is false. + // Default: false. + // + Stdin *bool `field:"optional" json:"stdin" yaml:"stdin"` + // Whether the container runtime should close the stdin channel after it has been opened by a single attach. + // + // When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false + // Default: false. + // + StdinOnce *bool `field:"optional" json:"stdinOnce" yaml:"stdinOnce"` + // If set, the name of the container from PodSpec that this ephemeral container targets. + // + // The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. If not set then the ephemeral container uses the namespaces configured in the Pod spec. + // + // The container runtime must implement support for this feature. If the runtime does not support namespace targeting then the result of setting this field is undefined. + TargetContainerName *string `field:"optional" json:"targetContainerName" yaml:"targetContainerName"` + // Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. + // + // Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated. + // Default: dev/termination-log. Cannot be updated. + // + TerminationMessagePath *string `field:"optional" json:"terminationMessagePath" yaml:"terminationMessagePath"` + // Indicate how the termination message should be populated. + // + // File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated. + // Default: File. Cannot be updated. + // + TerminationMessagePolicy *string `field:"optional" json:"terminationMessagePolicy" yaml:"terminationMessagePolicy"` + // Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. + // + // Default is false. + // Default: false. + // + Tty *bool `field:"optional" json:"tty" yaml:"tty"` + // volumeDevices is the list of block devices to be used by the container. + VolumeDevices *[]*VolumeDevice `field:"optional" json:"volumeDevices" yaml:"volumeDevices"` + // Pod volumes to mount into the container's filesystem. + // + // Subpath mounts are not allowed for ephemeral containers. Cannot be updated. + VolumeMounts *[]*VolumeMount `field:"optional" json:"volumeMounts" yaml:"volumeMounts"` + // Container's working directory. + // + // If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated. + WorkingDir *string `field:"optional" json:"workingDir" yaml:"workingDir"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EphemeralVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/EphemeralVolumeSource.go new file mode 100644 index 0000000..b511fa1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EphemeralVolumeSource.go @@ -0,0 +1,17 @@ +package k8s + + +// Represents an ephemeral volume that is handled by a normal storage driver. +type EphemeralVolumeSource struct { + // Will be used to create a stand-alone PVC to provision the volume. + // + // The pod in which this EphemeralVolumeSource is embedded will be the owner of the PVC, i.e. the PVC will be deleted together with the pod. The name of the PVC will be `-` where `` is the name from the `PodSpec.Volumes` array entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). + // + // An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until the unrelated PVC is removed. If such a pre-created PVC is meant to be used by the pod, the PVC has to updated with an owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster. + // + // This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. + // + // Required, must not be nil. + VolumeClaimTemplate *PersistentVolumeClaimTemplate `field:"optional" json:"volumeClaimTemplate" yaml:"volumeClaimTemplate"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EventSeries.go b/examples/cdk8s-sample-deployment/imports/k8s/EventSeries.go new file mode 100644 index 0000000..78e60f7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EventSeries.go @@ -0,0 +1,14 @@ +package k8s + +import ( + "time" +) + +// EventSeries contain information on series of events, i.e. thing that was/is happening continuously for some time. How often to update the EventSeries is up to the event reporters. The default event reporter in "k8s.io/client-go/tools/events/event_broadcaster.go" shows how this struct is updated on heartbeats and can guide customized reporter implementations. +type EventSeries struct { + // count is the number of occurrences in this series up to the last heartbeat time. + Count *float64 `field:"required" json:"count" yaml:"count"` + // lastObservedTime is the time when last Event from the series was seen before last heartbeat. + LastObservedTime *time.Time `field:"required" json:"lastObservedTime" yaml:"lastObservedTime"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/EventSource.go b/examples/cdk8s-sample-deployment/imports/k8s/EventSource.go new file mode 100644 index 0000000..fe94438 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/EventSource.go @@ -0,0 +1,11 @@ +package k8s + + +// EventSource contains information for an event. +type EventSource struct { + // Component from which the event is generated. + Component *string `field:"optional" json:"component" yaml:"component"` + // Node name on which the event is generated. + Host *string `field:"optional" json:"host" yaml:"host"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ExecAction.go b/examples/cdk8s-sample-deployment/imports/k8s/ExecAction.go new file mode 100644 index 0000000..07ec99d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ExecAction.go @@ -0,0 +1,11 @@ +package k8s + + +// ExecAction describes a "run in container" action. +type ExecAction struct { + // Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. + // + // The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + Command *[]*string `field:"optional" json:"command" yaml:"command"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ExternalDocumentation.go b/examples/cdk8s-sample-deployment/imports/k8s/ExternalDocumentation.go new file mode 100644 index 0000000..f9de875 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ExternalDocumentation.go @@ -0,0 +1,9 @@ +package k8s + + +// ExternalDocumentation allows referencing an external resource for extended documentation. +type ExternalDocumentation struct { + Description *string `field:"optional" json:"description" yaml:"description"` + Url *string `field:"optional" json:"url" yaml:"url"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ExternalMetricSourceV2.go b/examples/cdk8s-sample-deployment/imports/k8s/ExternalMetricSourceV2.go new file mode 100644 index 0000000..5c8276a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ExternalMetricSourceV2.go @@ -0,0 +1,11 @@ +package k8s + + +// ExternalMetricSource indicates how to scale on a metric not associated with any Kubernetes object (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). +type ExternalMetricSourceV2 struct { + // metric identifies the target metric by name and selector. + Metric *MetricIdentifierV2 `field:"required" json:"metric" yaml:"metric"` + // target specifies the target value for the given metric. + Target *MetricTargetV2 `field:"required" json:"target" yaml:"target"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ExternalMetricSourceV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/ExternalMetricSourceV2Beta2.go new file mode 100644 index 0000000..0917d78 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ExternalMetricSourceV2Beta2.go @@ -0,0 +1,11 @@ +package k8s + + +// ExternalMetricSource indicates how to scale on a metric not associated with any Kubernetes object (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). +type ExternalMetricSourceV2Beta2 struct { + // metric identifies the target metric by name and selector. + Metric *MetricIdentifierV2Beta2 `field:"required" json:"metric" yaml:"metric"` + // target specifies the target value for the given metric. + Target *MetricTargetV2Beta2 `field:"required" json:"target" yaml:"target"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/FcVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/FcVolumeSource.go new file mode 100644 index 0000000..4804a01 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/FcVolumeSource.go @@ -0,0 +1,25 @@ +package k8s + + +// Represents a Fibre Channel volume. +// +// Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling. +type FcVolumeSource struct { + // fsType is the filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // lun is Optional: FC target lun number. + Lun *float64 `field:"optional" json:"lun" yaml:"lun"` + // readOnly is Optional: Defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + // Default: false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // targetWWNs is Optional: FC target worldwide names (WWNs). + TargetWwNs *[]*string `field:"optional" json:"targetWwNs" yaml:"targetWwNs"` + // wwids Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. + Wwids *[]*string `field:"optional" json:"wwids" yaml:"wwids"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/FlexPersistentVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/FlexPersistentVolumeSource.go new file mode 100644 index 0000000..07b6e29 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/FlexPersistentVolumeSource.go @@ -0,0 +1,23 @@ +package k8s + + +// FlexPersistentVolumeSource represents a generic persistent volume resource that is provisioned/attached using an exec based plugin. +type FlexPersistentVolumeSource struct { + // driver is the name of the driver to use for this volume. + Driver *string `field:"required" json:"driver" yaml:"driver"` + // fsType is the Filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // options is Optional: this field holds extra command options if any. + Options *map[string]*string `field:"optional" json:"options" yaml:"options"` + // readOnly is Optional: defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretRef is Optional: SecretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. + // + // This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts. + SecretRef *SecretReference `field:"optional" json:"secretRef" yaml:"secretRef"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/FlexVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/FlexVolumeSource.go new file mode 100644 index 0000000..acfb132 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/FlexVolumeSource.go @@ -0,0 +1,23 @@ +package k8s + + +// FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. +type FlexVolumeSource struct { + // driver is the name of the driver to use for this volume. + Driver *string `field:"required" json:"driver" yaml:"driver"` + // fsType is the filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // options is Optional: this field holds extra command options if any. + Options *map[string]*string `field:"optional" json:"options" yaml:"options"` + // readOnly is Optional: defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretRef is Optional: secretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. + // + // This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts. + SecretRef *LocalObjectReference `field:"optional" json:"secretRef" yaml:"secretRef"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/FlockerVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/FlockerVolumeSource.go new file mode 100644 index 0000000..f1f0e83 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/FlockerVolumeSource.go @@ -0,0 +1,15 @@ +package k8s + + +// Represents a Flocker volume mounted by the Flocker agent. +// +// One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling. +type FlockerVolumeSource struct { + // datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated. + DatasetName *string `field:"optional" json:"datasetName" yaml:"datasetName"` + // datasetUUID is the UUID of the dataset. + // + // This is unique identifier of a Flocker dataset. + DatasetUuid *string `field:"optional" json:"datasetUuid" yaml:"datasetUuid"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/FlowDistinguisherMethodV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/FlowDistinguisherMethodV1Beta1.go new file mode 100644 index 0000000..5167678 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/FlowDistinguisherMethodV1Beta1.go @@ -0,0 +1,11 @@ +package k8s + + +// FlowDistinguisherMethod specifies the method of a flow distinguisher. +type FlowDistinguisherMethodV1Beta1 struct { + // `type` is the type of flow distinguisher method The supported types are "ByUser" and "ByNamespace". + // + // Required. + Type *string `field:"required" json:"type" yaml:"type"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/FlowDistinguisherMethodV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/FlowDistinguisherMethodV1Beta2.go new file mode 100644 index 0000000..24327ff --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/FlowDistinguisherMethodV1Beta2.go @@ -0,0 +1,11 @@ +package k8s + + +// FlowDistinguisherMethod specifies the method of a flow distinguisher. +type FlowDistinguisherMethodV1Beta2 struct { + // `type` is the type of flow distinguisher method The supported types are "ByUser" and "ByNamespace". + // + // Required. + Type *string `field:"required" json:"type" yaml:"type"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/FlowSchemaSpecV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/FlowSchemaSpecV1Beta1.go new file mode 100644 index 0000000..9464e0c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/FlowSchemaSpecV1Beta1.go @@ -0,0 +1,23 @@ +package k8s + + +// FlowSchemaSpec describes how the FlowSchema's specification looks like. +type FlowSchemaSpecV1Beta1 struct { + // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. + // + // If the reference cannot be resolved, the FlowSchema will be ignored and marked as invalid in its status. Required. + PriorityLevelConfiguration *PriorityLevelConfigurationReferenceV1Beta1 `field:"required" json:"priorityLevelConfiguration" yaml:"priorityLevelConfiguration"` + // `distinguisherMethod` defines how to compute the flow distinguisher for requests that match this schema. + // + // `nil` specifies that the distinguisher is disabled and thus will always be the empty string. + DistinguisherMethod *FlowDistinguisherMethodV1Beta1 `field:"optional" json:"distinguisherMethod" yaml:"distinguisherMethod"` + // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. + // + // The chosen FlowSchema is among those with the numerically lowest (which we take to be logically highest) MatchingPrecedence. Each MatchingPrecedence value must be ranged in [1,10000]. Note that if the precedence is not specified, it will be set to 1000 as default. + MatchingPrecedence *float64 `field:"optional" json:"matchingPrecedence" yaml:"matchingPrecedence"` + // `rules` describes which requests will match this flow schema. + // + // This FlowSchema matches a request if and only if at least one member of rules matches the request. if it is an empty slice, there will be no requests matching the FlowSchema. + Rules *[]*PolicyRulesWithSubjectsV1Beta1 `field:"optional" json:"rules" yaml:"rules"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/FlowSchemaSpecV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/FlowSchemaSpecV1Beta2.go new file mode 100644 index 0000000..aaf744d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/FlowSchemaSpecV1Beta2.go @@ -0,0 +1,23 @@ +package k8s + + +// FlowSchemaSpec describes how the FlowSchema's specification looks like. +type FlowSchemaSpecV1Beta2 struct { + // `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. + // + // If the reference cannot be resolved, the FlowSchema will be ignored and marked as invalid in its status. Required. + PriorityLevelConfiguration *PriorityLevelConfigurationReferenceV1Beta2 `field:"required" json:"priorityLevelConfiguration" yaml:"priorityLevelConfiguration"` + // `distinguisherMethod` defines how to compute the flow distinguisher for requests that match this schema. + // + // `nil` specifies that the distinguisher is disabled and thus will always be the empty string. + DistinguisherMethod *FlowDistinguisherMethodV1Beta2 `field:"optional" json:"distinguisherMethod" yaml:"distinguisherMethod"` + // `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. + // + // The chosen FlowSchema is among those with the numerically lowest (which we take to be logically highest) MatchingPrecedence. Each MatchingPrecedence value must be ranged in [1,10000]. Note that if the precedence is not specified, it will be set to 1000 as default. + MatchingPrecedence *float64 `field:"optional" json:"matchingPrecedence" yaml:"matchingPrecedence"` + // `rules` describes which requests will match this flow schema. + // + // This FlowSchema matches a request if and only if at least one member of rules matches the request. if it is an empty slice, there will be no requests matching the FlowSchema. + Rules *[]*PolicyRulesWithSubjectsV1Beta2 `field:"optional" json:"rules" yaml:"rules"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ForZone.go b/examples/cdk8s-sample-deployment/imports/k8s/ForZone.go new file mode 100644 index 0000000..ca1d44e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ForZone.go @@ -0,0 +1,9 @@ +package k8s + + +// ForZone provides information about which zones should consume this endpoint. +type ForZone struct { + // name represents the name of the zone. + Name *string `field:"required" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/GcePersistentDiskVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/GcePersistentDiskVolumeSource.go new file mode 100644 index 0000000..394f237 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/GcePersistentDiskVolumeSource.go @@ -0,0 +1,27 @@ +package k8s + + +// Represents a Persistent Disk resource in Google Compute Engine. +// +// A GCE PD must exist before mounting to a container. The disk must also be in the same GCE project and zone as the kubelet. A GCE PD can only be mounted as read/write once or read-only many times. GCE PDs support ownership management and SELinux relabeling. +type GcePersistentDiskVolumeSource struct { + // pdName is unique name of the PD resource in GCE. + // + // Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + PdName *string `field:"required" json:"pdName" yaml:"pdName"` + // fsType is filesystem type of the volume that you want to mount. + // + // Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // partition is the partition in the volume that you want to mount. + // + // If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + Partition *float64 `field:"optional" json:"partition" yaml:"partition"` + // readOnly here will force the ReadOnly setting in VolumeMounts. + // + // Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + // Default: false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/GitRepoVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/GitRepoVolumeSource.go new file mode 100644 index 0000000..7e23dc3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/GitRepoVolumeSource.go @@ -0,0 +1,19 @@ +package k8s + + +// Represents a volume that is populated with the contents of a git repository. +// +// Git repo volumes do not support ownership management. Git repo volumes support SELinux relabeling. +// +// DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container. +type GitRepoVolumeSource struct { + // repository is the URL. + Repository *string `field:"required" json:"repository" yaml:"repository"` + // directory is the target directory name. + // + // Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. + Directory *string `field:"optional" json:"directory" yaml:"directory"` + // revision is the commit hash for the specified revision. + Revision *string `field:"optional" json:"revision" yaml:"revision"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/GlusterfsPersistentVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/GlusterfsPersistentVolumeSource.go new file mode 100644 index 0000000..7b9a3dd --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/GlusterfsPersistentVolumeSource.go @@ -0,0 +1,27 @@ +package k8s + + +// Represents a Glusterfs mount that lasts the lifetime of a pod. +// +// Glusterfs volumes do not support ownership management or SELinux relabeling. +type GlusterfsPersistentVolumeSource struct { + // endpoints is the endpoint name that details Glusterfs topology. + // + // More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + Endpoints *string `field:"required" json:"endpoints" yaml:"endpoints"` + // path is the Glusterfs volume path. + // + // More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + Path *string `field:"required" json:"path" yaml:"path"` + // endpointsNamespace is the namespace that contains Glusterfs endpoint. + // + // If this field is empty, the EndpointNamespace defaults to the same namespace as the bound PVC. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + EndpointsNamespace *string `field:"optional" json:"endpointsNamespace" yaml:"endpointsNamespace"` + // readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + // + // Defaults to false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + // Default: false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/GlusterfsVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/GlusterfsVolumeSource.go new file mode 100644 index 0000000..c7a92c9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/GlusterfsVolumeSource.go @@ -0,0 +1,23 @@ +package k8s + + +// Represents a Glusterfs mount that lasts the lifetime of a pod. +// +// Glusterfs volumes do not support ownership management or SELinux relabeling. +type GlusterfsVolumeSource struct { + // endpoints is the endpoint name that details Glusterfs topology. + // + // More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + Endpoints *string `field:"required" json:"endpoints" yaml:"endpoints"` + // path is the Glusterfs volume path. + // + // More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + Path *string `field:"required" json:"path" yaml:"path"` + // readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + // + // Defaults to false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + // Default: false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/GroupSubjectV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/GroupSubjectV1Beta1.go new file mode 100644 index 0000000..689b808 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/GroupSubjectV1Beta1.go @@ -0,0 +1,11 @@ +package k8s + + +// GroupSubject holds detailed information for group-kind subject. +type GroupSubjectV1Beta1 struct { + // name is the user group that matches, or "*" to match all user groups. + // + // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some well-known group names. Required. + Name *string `field:"required" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/GroupSubjectV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/GroupSubjectV1Beta2.go new file mode 100644 index 0000000..de0e09d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/GroupSubjectV1Beta2.go @@ -0,0 +1,11 @@ +package k8s + + +// GroupSubject holds detailed information for group-kind subject. +type GroupSubjectV1Beta2 struct { + // name is the user group that matches, or "*" to match all user groups. + // + // See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some well-known group names. Required. + Name *string `field:"required" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/GrpcAction.go b/examples/cdk8s-sample-deployment/imports/k8s/GrpcAction.go new file mode 100644 index 0000000..0039e02 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/GrpcAction.go @@ -0,0 +1,14 @@ +package k8s + + +type GrpcAction struct { + // Port number of the gRPC service. + // + // Number must be in the range 1 to 65535. + Port *float64 `field:"required" json:"port" yaml:"port"` + // Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + // + // If this is not specified, the default behavior is defined by gRPC. + Service *string `field:"optional" json:"service" yaml:"service"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerBehaviorV2.go b/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerBehaviorV2.go new file mode 100644 index 0000000..ab1bc47 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerBehaviorV2.go @@ -0,0 +1,18 @@ +package k8s + + +// HorizontalPodAutoscalerBehavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). +type HorizontalPodAutoscalerBehaviorV2 struct { + // scaleDown is scaling policy for scaling Down. + // + // If not set, the default value is to allow to scale down to minReplicas pods, with a 300 second stabilization window (i.e., the highest recommendation for the last 300sec is used). + ScaleDown *HpaScalingRulesV2 `field:"optional" json:"scaleDown" yaml:"scaleDown"` + // scaleUp is scaling policy for scaling Up. + // + // If not set, the default value is the higher of: + // * increase no more than 4 pods per 60 seconds + // * double the number of pods per 60 seconds + // No stabilization is used. + ScaleUp *HpaScalingRulesV2 `field:"optional" json:"scaleUp" yaml:"scaleUp"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerBehaviorV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerBehaviorV2Beta2.go new file mode 100644 index 0000000..96f6471 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerBehaviorV2Beta2.go @@ -0,0 +1,18 @@ +package k8s + + +// HorizontalPodAutoscalerBehavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). +type HorizontalPodAutoscalerBehaviorV2Beta2 struct { + // scaleDown is scaling policy for scaling Down. + // + // If not set, the default value is to allow to scale down to minReplicas pods, with a 300 second stabilization window (i.e., the highest recommendation for the last 300sec is used). + ScaleDown *HpaScalingRulesV2Beta2 `field:"optional" json:"scaleDown" yaml:"scaleDown"` + // scaleUp is scaling policy for scaling Up. + // + // If not set, the default value is the higher of: + // * increase no more than 4 pods per 60 seconds + // * double the number of pods per 60 seconds + // No stabilization is used. + ScaleUp *HpaScalingRulesV2Beta2 `field:"optional" json:"scaleUp" yaml:"scaleUp"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerSpec.go new file mode 100644 index 0000000..b1c80e3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerSpec.go @@ -0,0 +1,23 @@ +package k8s + + +// specification of a horizontal pod autoscaler. +type HorizontalPodAutoscalerSpec struct { + // upper limit for the number of pods that can be set by the autoscaler; + // + // cannot be smaller than MinReplicas. + MaxReplicas *float64 `field:"required" json:"maxReplicas" yaml:"maxReplicas"` + // reference to scaled resource; + // + // horizontal pod autoscaler will learn the current resource consumption and will set the desired number of pods by using its Scale subresource. + ScaleTargetRef *CrossVersionObjectReference `field:"required" json:"scaleTargetRef" yaml:"scaleTargetRef"` + // minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. + // + // It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available. + MinReplicas *float64 `field:"optional" json:"minReplicas" yaml:"minReplicas"` + // target average CPU utilization (represented as a percentage of requested CPU) over all the pods; + // + // if not specified the default autoscaling policy will be used. + TargetCpuUtilizationPercentage *float64 `field:"optional" json:"targetCpuUtilizationPercentage" yaml:"targetCpuUtilizationPercentage"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerSpecV2.go b/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerSpecV2.go new file mode 100644 index 0000000..60752d5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerSpecV2.go @@ -0,0 +1,25 @@ +package k8s + + +// HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. +type HorizontalPodAutoscalerSpecV2 struct { + // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. + // + // It cannot be less that minReplicas. + MaxReplicas *float64 `field:"required" json:"maxReplicas" yaml:"maxReplicas"` + // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics should be collected, as well as to actually change the replica count. + ScaleTargetRef *CrossVersionObjectReferenceV2 `field:"required" json:"scaleTargetRef" yaml:"scaleTargetRef"` + // behavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). + // + // If not set, the default HPAScalingRules for scale up and scale down are used. + Behavior *HorizontalPodAutoscalerBehaviorV2 `field:"optional" json:"behavior" yaml:"behavior"` + // metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). + // + // The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization. + Metrics *[]*MetricSpecV2 `field:"optional" json:"metrics" yaml:"metrics"` + // minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. + // + // It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available. + MinReplicas *float64 `field:"optional" json:"minReplicas" yaml:"minReplicas"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerSpecV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerSpecV2Beta2.go new file mode 100644 index 0000000..67f54f8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HorizontalPodAutoscalerSpecV2Beta2.go @@ -0,0 +1,25 @@ +package k8s + + +// HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. +type HorizontalPodAutoscalerSpecV2Beta2 struct { + // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. + // + // It cannot be less that minReplicas. + MaxReplicas *float64 `field:"required" json:"maxReplicas" yaml:"maxReplicas"` + // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics should be collected, as well as to actually change the replica count. + ScaleTargetRef *CrossVersionObjectReferenceV2Beta2 `field:"required" json:"scaleTargetRef" yaml:"scaleTargetRef"` + // behavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). + // + // If not set, the default HPAScalingRules for scale up and scale down are used. + Behavior *HorizontalPodAutoscalerBehaviorV2Beta2 `field:"optional" json:"behavior" yaml:"behavior"` + // metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). + // + // The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization. + Metrics *[]*MetricSpecV2Beta2 `field:"optional" json:"metrics" yaml:"metrics"` + // minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. + // + // It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available. + MinReplicas *float64 `field:"optional" json:"minReplicas" yaml:"minReplicas"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HostAlias.go b/examples/cdk8s-sample-deployment/imports/k8s/HostAlias.go new file mode 100644 index 0000000..86ed706 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HostAlias.go @@ -0,0 +1,11 @@ +package k8s + + +// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file. +type HostAlias struct { + // Hostnames for the above IP address. + Hostnames *[]*string `field:"optional" json:"hostnames" yaml:"hostnames"` + // IP address of the host file entry. + Ip *string `field:"optional" json:"ip" yaml:"ip"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HostPathVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/HostPathVolumeSource.go new file mode 100644 index 0000000..5f3130e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HostPathVolumeSource.go @@ -0,0 +1,17 @@ +package k8s + + +// Represents a host path mapped into a pod. +// +// Host path volumes do not support ownership management or SELinux relabeling. +type HostPathVolumeSource struct { + // path of the directory on the host. + // + // If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + Path *string `field:"required" json:"path" yaml:"path"` + // type for HostPath Volume Defaults to "" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath. + // Default: More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + // + Type *string `field:"optional" json:"type" yaml:"type"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingPolicyV2.go b/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingPolicyV2.go new file mode 100644 index 0000000..3dc305b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingPolicyV2.go @@ -0,0 +1,17 @@ +package k8s + + +// HPAScalingPolicy is a single policy which must hold true for a specified past interval. +type HpaScalingPolicyV2 struct { + // PeriodSeconds specifies the window of time for which the policy should hold true. + // + // PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). + PeriodSeconds *float64 `field:"required" json:"periodSeconds" yaml:"periodSeconds"` + // Type is used to specify the scaling policy. + Type *string `field:"required" json:"type" yaml:"type"` + // Value contains the amount of change which is permitted by the policy. + // + // It must be greater than zero. + Value *float64 `field:"required" json:"value" yaml:"value"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingPolicyV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingPolicyV2Beta2.go new file mode 100644 index 0000000..6914d1b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingPolicyV2Beta2.go @@ -0,0 +1,17 @@ +package k8s + + +// HPAScalingPolicy is a single policy which must hold true for a specified past interval. +type HpaScalingPolicyV2Beta2 struct { + // PeriodSeconds specifies the window of time for which the policy should hold true. + // + // PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). + PeriodSeconds *float64 `field:"required" json:"periodSeconds" yaml:"periodSeconds"` + // Type is used to specify the scaling policy. + Type *string `field:"required" json:"type" yaml:"type"` + // Value contains the amount of change which is permitted by the policy. + // + // It must be greater than zero. + Value *float64 `field:"required" json:"value" yaml:"value"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingRulesV2.go b/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingRulesV2.go new file mode 100644 index 0000000..d1020ca --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingRulesV2.go @@ -0,0 +1,21 @@ +package k8s + + +// HPAScalingRules configures the scaling behavior for one direction. +// +// These Rules are applied after calculating DesiredReplicas from metrics for the HPA. They can limit the scaling velocity by specifying scaling policies. They can prevent flapping by specifying the stabilization window, so that the number of replicas is not set instantly, instead, the safest value from the stabilization window is chosen. +type HpaScalingRulesV2 struct { + // policies is a list of potential scaling polices which can be used during scaling. + // + // At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid. + Policies *[]*HpaScalingPolicyV2 `field:"optional" json:"policies" yaml:"policies"` + // selectPolicy is used to specify which policy should be used. + // + // If not set, the default value Max is used. + SelectPolicy *string `field:"optional" json:"selectPolicy" yaml:"selectPolicy"` + // StabilizationWindowSeconds is the number of seconds for which past recommendations should be considered while scaling up or scaling down. + // + // StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). If not set, use the default values: - For scale up: 0 (i.e. no stabilization is done). - For scale down: 300 (i.e. the stabilization window is 300 seconds long). + StabilizationWindowSeconds *float64 `field:"optional" json:"stabilizationWindowSeconds" yaml:"stabilizationWindowSeconds"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingRulesV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingRulesV2Beta2.go new file mode 100644 index 0000000..76d4a8d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HpaScalingRulesV2Beta2.go @@ -0,0 +1,21 @@ +package k8s + + +// HPAScalingRules configures the scaling behavior for one direction. +// +// These Rules are applied after calculating DesiredReplicas from metrics for the HPA. They can limit the scaling velocity by specifying scaling policies. They can prevent flapping by specifying the stabilization window, so that the number of replicas is not set instantly, instead, the safest value from the stabilization window is chosen. +type HpaScalingRulesV2Beta2 struct { + // policies is a list of potential scaling polices which can be used during scaling. + // + // At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid. + Policies *[]*HpaScalingPolicyV2Beta2 `field:"optional" json:"policies" yaml:"policies"` + // selectPolicy is used to specify which policy should be used. + // + // If not set, the default value MaxPolicySelect is used. + SelectPolicy *string `field:"optional" json:"selectPolicy" yaml:"selectPolicy"` + // StabilizationWindowSeconds is the number of seconds for which past recommendations should be considered while scaling up or scaling down. + // + // StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). If not set, use the default values: - For scale up: 0 (i.e. no stabilization is done). - For scale down: 300 (i.e. the stabilization window is 300 seconds long). + StabilizationWindowSeconds *float64 `field:"optional" json:"stabilizationWindowSeconds" yaml:"stabilizationWindowSeconds"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HttpGetAction.go b/examples/cdk8s-sample-deployment/imports/k8s/HttpGetAction.go new file mode 100644 index 0000000..7c258e9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HttpGetAction.go @@ -0,0 +1,27 @@ +package k8s + + +// HTTPGetAction describes an action based on HTTP Get requests. +type HttpGetAction struct { + // Name or number of the port to access on the container. + // + // Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. + Port IntOrString `field:"required" json:"port" yaml:"port"` + // Host name to connect to, defaults to the pod IP. + // + // You probably want to set "Host" in httpHeaders instead. + Host *string `field:"optional" json:"host" yaml:"host"` + // Custom headers to set in the request. + // + // HTTP allows repeated headers. + HttpHeaders *[]*HttpHeader `field:"optional" json:"httpHeaders" yaml:"httpHeaders"` + // Path to access on the HTTP server. + Path *string `field:"optional" json:"path" yaml:"path"` + // Scheme to use for connecting to the host. + // + // Defaults to HTTP. + // Default: HTTP. + // + Scheme *string `field:"optional" json:"scheme" yaml:"scheme"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HttpHeader.go b/examples/cdk8s-sample-deployment/imports/k8s/HttpHeader.go new file mode 100644 index 0000000..92aa13f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HttpHeader.go @@ -0,0 +1,11 @@ +package k8s + + +// HTTPHeader describes a custom header to be used in HTTP probes. +type HttpHeader struct { + // The header field name. + Name *string `field:"required" json:"name" yaml:"name"` + // The header field value. + Value *string `field:"required" json:"value" yaml:"value"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HttpIngressPath.go b/examples/cdk8s-sample-deployment/imports/k8s/HttpIngressPath.go new file mode 100644 index 0000000..c7cefd1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HttpIngressPath.go @@ -0,0 +1,29 @@ +package k8s + + +// HTTPIngressPath associates a path with a backend. +// +// Incoming urls matching the path are forwarded to the backend. +type HttpIngressPath struct { + // Backend defines the referenced service endpoint to which the traffic will be forwarded to. + Backend *IngressBackend `field:"required" json:"backend" yaml:"backend"` + // PathType determines the interpretation of the Path matching. + // + // PathType can be one of the following values: * Exact: Matches the URL path exactly. * Prefix: Matches based on a URL path prefix split by '/'. Matching is + // done on a path element by element basis. A path element refers is the + // list of labels in the path split by the '/' separator. A request is a + // match for path p if every p is an element-wise prefix of p of the + // request path. Note that if the last element of the path is a substring + // of the last element in request path, it is not a match (e.g. /foo/bar + // matches /foo/bar/baz, but does not match /foo/barbaz). + // * ImplementationSpecific: Interpretation of the Path matching is up to + // the IngressClass. Implementations can treat this as a separate PathType + // or treat it identically to Prefix or Exact path types. + // Implementations are required to support all path types. + PathType *string `field:"required" json:"pathType" yaml:"pathType"` + // Path is matched against the path of an incoming request. + // + // Currently it can contain characters disallowed from the conventional "path" part of a URL as defined by RFC 3986. Paths must begin with a '/' and must be present when using PathType with value "Exact" or "Prefix". + Path *string `field:"optional" json:"path" yaml:"path"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/HttpIngressRuleValue.go b/examples/cdk8s-sample-deployment/imports/k8s/HttpIngressRuleValue.go new file mode 100644 index 0000000..809f65b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/HttpIngressRuleValue.go @@ -0,0 +1,11 @@ +package k8s + + +// HTTPIngressRuleValue is a list of http selectors pointing to backends. +// +// In the example: http:///? -> backend where where parts of the url correspond to RFC 3986, this resource will be used to match against everything after the last '/' and before the first '?' or '#'. +type HttpIngressRuleValue struct { + // A collection of paths that map requests to backends. + Paths *[]*HttpIngressPath `field:"required" json:"paths" yaml:"paths"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IngressBackend.go b/examples/cdk8s-sample-deployment/imports/k8s/IngressBackend.go new file mode 100644 index 0000000..d414e98 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IngressBackend.go @@ -0,0 +1,15 @@ +package k8s + + +// IngressBackend describes all endpoints for a given service and port. +type IngressBackend struct { + // Resource is an ObjectRef to another Kubernetes resource in the namespace of the Ingress object. + // + // If resource is specified, a service.Name and service.Port must not be specified. This is a mutually exclusive setting with "Service". + Resource *TypedLocalObjectReference `field:"optional" json:"resource" yaml:"resource"` + // Service references a Service as a Backend. + // + // This is a mutually exclusive setting with "Resource". + Service *IngressServiceBackend `field:"optional" json:"service" yaml:"service"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IngressClassParametersReference.go b/examples/cdk8s-sample-deployment/imports/k8s/IngressClassParametersReference.go new file mode 100644 index 0000000..18e83ef --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IngressClassParametersReference.go @@ -0,0 +1,25 @@ +package k8s + + +// IngressClassParametersReference identifies an API object. +// +// This can be used to specify a cluster or namespace-scoped resource. +type IngressClassParametersReference struct { + // Kind is the type of resource being referenced. + Kind *string `field:"required" json:"kind" yaml:"kind"` + // Name is the name of resource being referenced. + Name *string `field:"required" json:"name" yaml:"name"` + // APIGroup is the group for the resource being referenced. + // + // If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. + ApiGroup *string `field:"optional" json:"apiGroup" yaml:"apiGroup"` + // Namespace is the namespace of the resource being referenced. + // + // This field is required when scope is set to "Namespace" and must be unset when scope is set to "Cluster". + Namespace *string `field:"optional" json:"namespace" yaml:"namespace"` + // Scope represents if this refers to a cluster or namespace scoped resource. + // + // This may be set to "Cluster" (default) or "Namespace". + Scope *string `field:"optional" json:"scope" yaml:"scope"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IngressClassSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/IngressClassSpec.go new file mode 100644 index 0000000..62e2d6e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IngressClassSpec.go @@ -0,0 +1,15 @@ +package k8s + + +// IngressClassSpec provides information about the class of an Ingress. +type IngressClassSpec struct { + // Controller refers to the name of the controller that should handle this class. + // + // This allows for different "flavors" that are controlled by the same controller. For example, you may have different Parameters for the same implementing controller. This should be specified as a domain-prefixed path no more than 250 characters in length, e.g. "acme.io/ingress-controller". This field is immutable. + Controller *string `field:"optional" json:"controller" yaml:"controller"` + // Parameters is a link to a custom resource containing additional configuration for the controller. + // + // This is optional if the controller does not require extra parameters. + Parameters *IngressClassParametersReference `field:"optional" json:"parameters" yaml:"parameters"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IngressRule.go b/examples/cdk8s-sample-deployment/imports/k8s/IngressRule.go new file mode 100644 index 0000000..d77f63d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IngressRule.go @@ -0,0 +1,21 @@ +package k8s + + +// IngressRule represents the rules mapping the paths under a specified host to the related backend services. +// +// Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue. +type IngressRule struct { + // Host is the fully qualified domain name of a network host, as defined by RFC 3986. + // + // Note the following deviations from the "host" part of the URI as defined in RFC 3986: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to + // the IP in the Spec of the parent Ingress. + // 2. The `:` delimiter is not respected because ports are not allowed. + // Currently the port of an Ingress is implicitly :80 for http and + // :443 for https. + // Both these may change in the future. Incoming requests are matched against the host before the IngressRuleValue. If the host is unspecified, the Ingress routes all traffic based on the specified IngressRuleValue. + // + // Host can be "precise" which is a domain name without the terminating dot of a network host (e.g. "foo.bar.com") or "wildcard", which is a domain name prefixed with a single wildcard label (e.g. "*.foo.com"). The wildcard character '*' must appear by itself as the first DNS label and matches only a single label. You cannot have a wildcard label by itself (e.g. Host == "*"). Requests will be matched against the Host field in the following way: 1. If Host is precise, the request matches this rule if the http host header is equal to Host. 2. If Host is a wildcard, then the request matches this rule if the http host header is to equal to the suffix (removing the first label) of the wildcard rule. + Host *string `field:"optional" json:"host" yaml:"host"` + Http *HttpIngressRuleValue `field:"optional" json:"http" yaml:"http"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IngressServiceBackend.go b/examples/cdk8s-sample-deployment/imports/k8s/IngressServiceBackend.go new file mode 100644 index 0000000..72336b1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IngressServiceBackend.go @@ -0,0 +1,15 @@ +package k8s + + +// IngressServiceBackend references a Kubernetes Service as a Backend. +type IngressServiceBackend struct { + // Name is the referenced service. + // + // The service must exist in the same namespace as the Ingress object. + Name *string `field:"required" json:"name" yaml:"name"` + // Port of the referenced service. + // + // A port name or port number is required for a IngressServiceBackend. + Port *ServiceBackendPort `field:"optional" json:"port" yaml:"port"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IngressSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/IngressSpec.go new file mode 100644 index 0000000..7747798 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IngressSpec.go @@ -0,0 +1,23 @@ +package k8s + + +// IngressSpec describes the Ingress the user wishes to exist. +type IngressSpec struct { + // DefaultBackend is the backend that should handle requests that don't match any rule. + // + // If Rules are not specified, DefaultBackend must be specified. If DefaultBackend is not set, the handling of requests that do not match any of the rules will be up to the Ingress controller. + DefaultBackend *IngressBackend `field:"optional" json:"defaultBackend" yaml:"defaultBackend"` + // IngressClassName is the name of an IngressClass cluster resource. + // + // Ingress controller implementations use this field to know whether they should be serving this Ingress resource, by a transitive connection (controller -> IngressClass -> Ingress resource). Although the `kubernetes.io/ingress.class` annotation (simple constant name) was never formally defined, it was widely supported by Ingress controllers to create a direct binding between Ingress controller and Ingress resources. Newly created Ingress resources should prefer using the field. However, even though the annotation is officially deprecated, for backwards compatibility reasons, ingress controllers should still honor that annotation if present. + IngressClassName *string `field:"optional" json:"ingressClassName" yaml:"ingressClassName"` + // A list of host rules used to configure the Ingress. + // + // If unspecified, or no rule matches, all traffic is sent to the default backend. + Rules *[]*IngressRule `field:"optional" json:"rules" yaml:"rules"` + // TLS configuration. + // + // Currently the Ingress only supports a single TLS port, 443. If multiple members of this list specify different hosts, they will be multiplexed on the same port according to the hostname specified through the SNI TLS extension, if the ingress controller fulfilling the ingress supports SNI. + Tls *[]*IngressTls `field:"optional" json:"tls" yaml:"tls"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IngressTls.go b/examples/cdk8s-sample-deployment/imports/k8s/IngressTls.go new file mode 100644 index 0000000..9d409c0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IngressTls.go @@ -0,0 +1,17 @@ +package k8s + + +// IngressTLS describes the transport layer security associated with an Ingress. +type IngressTls struct { + // Hosts are a list of hosts included in the TLS certificate. + // + // The values in this list must match the name/s used in the tlsSecret. Defaults to the wildcard host setting for the loadbalancer controller fulfilling this Ingress, if left unspecified. + // Default: the wildcard host setting for the loadbalancer controller fulfilling this Ingress, if left unspecified. + // + Hosts *[]*string `field:"optional" json:"hosts" yaml:"hosts"` + // SecretName is the name of the secret used to terminate TLS traffic on port 443. + // + // Field is left optional to allow TLS routing based on SNI hostname alone. If the SNI host in a listener conflicts with the "Host" header field used by an IngressRule, the SNI host is used for termination and value of the Host header is used for routing. + SecretName *string `field:"optional" json:"secretName" yaml:"secretName"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IntOrString.go b/examples/cdk8s-sample-deployment/imports/k8s/IntOrString.go new file mode 100644 index 0000000..d4188ad --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IntOrString.go @@ -0,0 +1,63 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" +) + +type IntOrString interface { + Value() interface{} +} + +// The jsii proxy struct for IntOrString +type jsiiProxy_IntOrString struct { + _ byte // padding +} + +func (j *jsiiProxy_IntOrString) Value() interface{} { + var returns interface{} + _jsii_.Get( + j, + "value", + &returns, + ) + return returns +} + + +func IntOrString_FromNumber(value *float64) IntOrString { + _init_.Initialize() + + if err := validateIntOrString_FromNumberParameters(value); err != nil { + panic(err) + } + var returns IntOrString + + _jsii_.StaticInvoke( + "k8s.IntOrString", + "fromNumber", + []interface{}{value}, + &returns, + ) + + return returns +} + +func IntOrString_FromString(value *string) IntOrString { + _init_.Initialize() + + if err := validateIntOrString_FromStringParameters(value); err != nil { + panic(err) + } + var returns IntOrString + + _jsii_.StaticInvoke( + "k8s.IntOrString", + "fromString", + []interface{}{value}, + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IntOrString__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/IntOrString__checks.go new file mode 100644 index 0000000..0b0e648 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IntOrString__checks.go @@ -0,0 +1,24 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" +) + +func validateIntOrString_FromNumberParameters(value *float64) error { + if value == nil { + return fmt.Errorf("parameter value is required, but nil was provided") + } + + return nil +} + +func validateIntOrString_FromStringParameters(value *string) error { + if value == nil { + return fmt.Errorf("parameter value is required, but nil was provided") + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IntOrString__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/IntOrString__no_checks.go new file mode 100644 index 0000000..d18d4ef --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IntOrString__no_checks.go @@ -0,0 +1,14 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateIntOrString_FromNumberParameters(value *float64) error { + return nil +} + +func validateIntOrString_FromStringParameters(value *string) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IoK8SApimachineryPkgApisMetaV1DeleteOptionsKind.go b/examples/cdk8s-sample-deployment/imports/k8s/IoK8SApimachineryPkgApisMetaV1DeleteOptionsKind.go new file mode 100644 index 0000000..964e725 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IoK8SApimachineryPkgApisMetaV1DeleteOptionsKind.go @@ -0,0 +1,13 @@ +package k8s + + +// 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 IoK8SApimachineryPkgApisMetaV1DeleteOptionsKind string + +const ( + // DeleteOptions. + IoK8SApimachineryPkgApisMetaV1DeleteOptionsKind_DELETE_OPTIONS IoK8SApimachineryPkgApisMetaV1DeleteOptionsKind = "DELETE_OPTIONS" +) + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IpBlock.go b/examples/cdk8s-sample-deployment/imports/k8s/IpBlock.go new file mode 100644 index 0000000..3978fd9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IpBlock.go @@ -0,0 +1,13 @@ +package k8s + + +// IPBlock describes a particular CIDR (Ex. +// +// "192.168.1.1/24","2001:db9::/64") that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs that should not be included within this rule. +type IpBlock struct { + // CIDR is a string representing the IP Block Valid examples are "192.168.1.1/24" or "2001:db9::/64". + Cidr *string `field:"required" json:"cidr" yaml:"cidr"` + // Except is a slice of CIDRs that should not be included within an IP Block Valid examples are "192.168.1.1/24" or "2001:db9::/64" Except values will be rejected if they are outside the CIDR range. + Except *[]*string `field:"optional" json:"except" yaml:"except"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IscsiPersistentVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/IscsiPersistentVolumeSource.go new file mode 100644 index 0000000..2f27312 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IscsiPersistentVolumeSource.go @@ -0,0 +1,47 @@ +package k8s + + +// ISCSIPersistentVolumeSource represents an ISCSI disk. +// +// ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling. +type IscsiPersistentVolumeSource struct { + // iqn is Target iSCSI Qualified Name. + Iqn *string `field:"required" json:"iqn" yaml:"iqn"` + // lun is iSCSI Target Lun number. + Lun *float64 `field:"required" json:"lun" yaml:"lun"` + // targetPortal is iSCSI Target Portal. + // + // The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). + TargetPortal *string `field:"required" json:"targetPortal" yaml:"targetPortal"` + // chapAuthDiscovery defines whether support iSCSI Discovery CHAP authentication. + ChapAuthDiscovery *bool `field:"optional" json:"chapAuthDiscovery" yaml:"chapAuthDiscovery"` + // chapAuthSession defines whether support iSCSI Session CHAP authentication. + ChapAuthSession *bool `field:"optional" json:"chapAuthSession" yaml:"chapAuthSession"` + // fsType is the filesystem type of the volume that you want to mount. + // + // Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // initiatorName is the custom iSCSI Initiator Name. + // + // If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface : will be created for the connection. + InitiatorName *string `field:"optional" json:"initiatorName" yaml:"initiatorName"` + // iscsiInterface is the interface Name that uses an iSCSI transport. + // + // Defaults to 'default' (tcp). + // Default: default' (tcp). + // + IscsiInterface *string `field:"optional" json:"iscsiInterface" yaml:"iscsiInterface"` + // portals is the iSCSI Target Portal List. + // + // The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). + Portals *[]*string `field:"optional" json:"portals" yaml:"portals"` + // readOnly here will force the ReadOnly setting in VolumeMounts. + // + // Defaults to false. + // Default: false. + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretRef is the CHAP Secret for iSCSI target and initiator authentication. + SecretRef *SecretReference `field:"optional" json:"secretRef" yaml:"secretRef"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/IscsiVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/IscsiVolumeSource.go new file mode 100644 index 0000000..d46e3a7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/IscsiVolumeSource.go @@ -0,0 +1,47 @@ +package k8s + + +// Represents an ISCSI disk. +// +// ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling. +type IscsiVolumeSource struct { + // iqn is the target iSCSI Qualified Name. + Iqn *string `field:"required" json:"iqn" yaml:"iqn"` + // lun represents iSCSI Target Lun number. + Lun *float64 `field:"required" json:"lun" yaml:"lun"` + // targetPortal is iSCSI Target Portal. + // + // The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). + TargetPortal *string `field:"required" json:"targetPortal" yaml:"targetPortal"` + // chapAuthDiscovery defines whether support iSCSI Discovery CHAP authentication. + ChapAuthDiscovery *bool `field:"optional" json:"chapAuthDiscovery" yaml:"chapAuthDiscovery"` + // chapAuthSession defines whether support iSCSI Session CHAP authentication. + ChapAuthSession *bool `field:"optional" json:"chapAuthSession" yaml:"chapAuthSession"` + // fsType is the filesystem type of the volume that you want to mount. + // + // Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // initiatorName is the custom iSCSI Initiator Name. + // + // If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface : will be created for the connection. + InitiatorName *string `field:"optional" json:"initiatorName" yaml:"initiatorName"` + // iscsiInterface is the interface Name that uses an iSCSI transport. + // + // Defaults to 'default' (tcp). + // Default: default' (tcp). + // + IscsiInterface *string `field:"optional" json:"iscsiInterface" yaml:"iscsiInterface"` + // portals is the iSCSI Target Portal List. + // + // The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). + Portals *[]*string `field:"optional" json:"portals" yaml:"portals"` + // readOnly here will force the ReadOnly setting in VolumeMounts. + // + // Defaults to false. + // Default: false. + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretRef is the CHAP Secret for iSCSI target and initiator authentication. + SecretRef *LocalObjectReference `field:"optional" json:"secretRef" yaml:"secretRef"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/JobSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/JobSpec.go new file mode 100644 index 0000000..49c1c50 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/JobSpec.go @@ -0,0 +1,61 @@ +package k8s + + +// JobSpec describes how the job execution will look like. +type JobSpec struct { + // Describes the pod that will be created when executing a job. + // + // More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + Template *PodTemplateSpec `field:"required" json:"template" yaml:"template"` + // Specifies the duration in seconds relative to the startTime that the job may be continuously active before the system tries to terminate it; + // + // value must be positive integer. If a Job is suspended (at creation or through an update), this timer will effectively be stopped and reset when the Job is resumed again. + ActiveDeadlineSeconds *float64 `field:"optional" json:"activeDeadlineSeconds" yaml:"activeDeadlineSeconds"` + // Specifies the number of retries before marking this job failed. + // + // Defaults to 6. + // Default: 6. + // + BackoffLimit *float64 `field:"optional" json:"backoffLimit" yaml:"backoffLimit"` + // CompletionMode specifies how Pod completions are tracked. It can be `NonIndexed` (default) or `Indexed`. + // + // `NonIndexed` means that the Job is considered complete when there have been .spec.completions successfully completed Pods. Each Pod completion is homologous to each other. + // + // `Indexed` means that the Pods of a Job get an associated completion index from 0 to (.spec.completions - 1), available in the annotation batch.kubernetes.io/job-completion-index. The Job is considered complete when there is one successfully completed Pod for each index. When value is `Indexed`, .spec.completions must be specified and `.spec.parallelism` must be less than or equal to 10^5. In addition, The Pod name takes the form `$(job-name)-$(index)-$(random-string)`, the Pod hostname takes the form `$(job-name)-$(index)`. + // + // More completion modes can be added in the future. If the Job controller observes a mode that it doesn't recognize, which is possible during upgrades due to version skew, the controller skips updates for the Job. + CompletionMode *string `field:"optional" json:"completionMode" yaml:"completionMode"` + // Specifies the desired number of successfully finished pods the job should be run with. + // + // Setting to nil means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + Completions *float64 `field:"optional" json:"completions" yaml:"completions"` + // manualSelector controls generation of pod labels and pod selectors. + // + // Leave `manualSelector` unset unless you are certain what you are doing. When false or unset, the system pick labels unique to this job and appends those labels to the pod template. When true, the user is responsible for picking unique labels and specifying the selector. Failure to pick a unique label may cause this and other jobs to not function correctly. However, You may see `manualSelector=true` in jobs that were created with the old `extensions/v1beta1` API. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#specifying-your-own-pod-selector + ManualSelector *bool `field:"optional" json:"manualSelector" yaml:"manualSelector"` + // Specifies the maximum desired number of pods the job should run at any given time. + // + // The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + Parallelism *float64 `field:"optional" json:"parallelism" yaml:"parallelism"` + // Specifies the policy of handling failed pods. + // + // In particular, it allows to specify the set of actions and conditions which need to be satisfied to take the associated action. If empty, the default behaviour applies - the counter of failed pods, represented by the jobs's .status.failed field, is incremented and it is checked against the backoffLimit. This field cannot be used in combination with restartPolicy=OnFailure. + // + // This field is alpha-level. To use this field, you must enable the `JobPodFailurePolicy` feature gate (disabled by default). + PodFailurePolicy *PodFailurePolicy `field:"optional" json:"podFailurePolicy" yaml:"podFailurePolicy"` + // A label query over pods that should match the pod count. + // + // Normally, the system sets this field for you. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector *LabelSelector `field:"optional" json:"selector" yaml:"selector"` + // Suspend specifies whether the Job controller should create Pods or not. + // + // If a Job is created with suspend set to true, no Pods are created by the Job controller. If a Job is suspended after creation (i.e. the flag goes from false to true), the Job controller will delete all active Pods associated with this Job. Users must design their workload to gracefully handle this. Suspending a Job will reset the StartTime field of the Job, effectively resetting the ActiveDeadlineSeconds timer too. Defaults to false. + // Default: false. + // + Suspend *bool `field:"optional" json:"suspend" yaml:"suspend"` + // ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed). + // + // If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. When the Job is being deleted, its lifecycle guarantees (e.g. finalizers) will be honored. If this field is unset, the Job won't be automatically deleted. If this field is set to zero, the Job becomes eligible to be deleted immediately after it finishes. + TtlSecondsAfterFinished *float64 `field:"optional" json:"ttlSecondsAfterFinished" yaml:"ttlSecondsAfterFinished"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/JobTemplateSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/JobTemplateSpec.go new file mode 100644 index 0000000..71c255c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/JobTemplateSpec.go @@ -0,0 +1,15 @@ +package k8s + + +// JobTemplateSpec describes the data a Job should have when created from a template. +type JobTemplateSpec struct { + // Standard object's metadata of the jobs created from this template. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Specification of the desired behavior of the job. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *JobSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/JsonSchemaProps.go b/examples/cdk8s-sample-deployment/imports/k8s/JsonSchemaProps.go new file mode 100644 index 0000000..8091394 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/JsonSchemaProps.go @@ -0,0 +1,109 @@ +package k8s + + +// JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/). +type JsonSchemaProps struct { + AdditionalItems interface{} `field:"optional" json:"additionalItems" yaml:"additionalItems"` + AdditionalProperties interface{} `field:"optional" json:"additionalProperties" yaml:"additionalProperties"` + AllOf *[]*JsonSchemaProps `field:"optional" json:"allOf" yaml:"allOf"` + AnyOf *[]*JsonSchemaProps `field:"optional" json:"anyOf" yaml:"anyOf"` + // default is a default value for undefined object fields. + // + // Defaulting is a beta feature under the CustomResourceDefaulting feature gate. Defaulting requires spec.preserveUnknownFields to be false. + Default interface{} `field:"optional" json:"default" yaml:"default"` + Definitions *map[string]*JsonSchemaProps `field:"optional" json:"definitions" yaml:"definitions"` + Dependencies *map[string]interface{} `field:"optional" json:"dependencies" yaml:"dependencies"` + Description *string `field:"optional" json:"description" yaml:"description"` + Enum *[]interface{} `field:"optional" json:"enum" yaml:"enum"` + Example interface{} `field:"optional" json:"example" yaml:"example"` + ExclusiveMaximum *bool `field:"optional" json:"exclusiveMaximum" yaml:"exclusiveMaximum"` + ExclusiveMinimum *bool `field:"optional" json:"exclusiveMinimum" yaml:"exclusiveMinimum"` + ExternalDocs *ExternalDocumentation `field:"optional" json:"externalDocs" yaml:"externalDocs"` + // format is an OpenAPI v3 format string. Unknown formats are ignored. The following formats are validated:. + // + // - bsonobjectid: a bson object ID, i.e. a 24 characters hex string - uri: an URI as parsed by Golang net/url.ParseRequestURI - email: an email address as parsed by Golang net/mail.ParseAddress - hostname: a valid representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034]. - ipv4: an IPv4 IP as parsed by Golang net.ParseIP - ipv6: an IPv6 IP as parsed by Golang net.ParseIP - cidr: a CIDR as parsed by Golang net.ParseCIDR - mac: a MAC address as parsed by Golang net.ParseMAC - uuid: an UUID that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$ - uuid3: an UUID3 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$ - uuid4: an UUID4 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ - uuid5: an UUID5 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ - isbn: an ISBN10 or ISBN13 number string like "0321751043" or "978-0321751041" - isbn10: an ISBN10 number string like "0321751043" - isbn13: an ISBN13 number string like "978-0321751041" - creditcard: a credit card number defined by the regex ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$ with any non digit characters mixed in - ssn: a U.S. social security number following the regex ^\d{3}[- ]?\d{2}[- ]?\d{4}$ - hexcolor: an hexadecimal color code like "#FFFFFF: following the regex ^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ - rgbcolor: an RGB color code like rgb like "rgb(255,255,2559" - byte: base64 encoded binary data - password: any kind of string - date: a date string like "2006-01-02" as defined by full-date in RFC3339 - duration: a duration string like "22 ns" as parsed by Golang time.ParseDuration or compatible with Scala duration format - datetime: a date time string like "2014-12-15T19:30:20.000Z" as defined by date-time in RFC3339. + Format *string `field:"optional" json:"format" yaml:"format"` + Id *string `field:"optional" json:"id" yaml:"id"` + Items interface{} `field:"optional" json:"items" yaml:"items"` + Maximum *float64 `field:"optional" json:"maximum" yaml:"maximum"` + MaxItems *float64 `field:"optional" json:"maxItems" yaml:"maxItems"` + MaxLength *float64 `field:"optional" json:"maxLength" yaml:"maxLength"` + MaxProperties *float64 `field:"optional" json:"maxProperties" yaml:"maxProperties"` + Minimum *float64 `field:"optional" json:"minimum" yaml:"minimum"` + MinItems *float64 `field:"optional" json:"minItems" yaml:"minItems"` + MinLength *float64 `field:"optional" json:"minLength" yaml:"minLength"` + MinProperties *float64 `field:"optional" json:"minProperties" yaml:"minProperties"` + MultipleOf *float64 `field:"optional" json:"multipleOf" yaml:"multipleOf"` + Not **JsonSchemaProps `field:"optional" json:"not" yaml:"not"` + Nullable *bool `field:"optional" json:"nullable" yaml:"nullable"` + OneOf *[]*JsonSchemaProps `field:"optional" json:"oneOf" yaml:"oneOf"` + Pattern *string `field:"optional" json:"pattern" yaml:"pattern"` + PatternProperties *map[string]*JsonSchemaProps `field:"optional" json:"patternProperties" yaml:"patternProperties"` + Properties *map[string]*JsonSchemaProps `field:"optional" json:"properties" yaml:"properties"` + Ref *string `field:"optional" json:"ref" yaml:"ref"` + Required *[]*string `field:"optional" json:"required" yaml:"required"` + Schema *string `field:"optional" json:"schema" yaml:"schema"` + Title *string `field:"optional" json:"title" yaml:"title"` + Type *string `field:"optional" json:"type" yaml:"type"` + UniqueItems *bool `field:"optional" json:"uniqueItems" yaml:"uniqueItems"` + // x-kubernetes-embedded-resource defines that the value is an embedded Kubernetes runtime.Object, with TypeMeta and ObjectMeta. The type must be object. It is allowed to further restrict the embedded object. kind, apiVersion and metadata are validated automatically. x-kubernetes-preserve-unknown-fields is allowed to be true, but does not have to be if the object is fully specified (up to kind, apiVersion, metadata). + XKubernetesEmbeddedResource *bool `field:"optional" json:"xKubernetesEmbeddedResource" yaml:"xKubernetesEmbeddedResource"` + // x-kubernetes-int-or-string specifies that this value is either an integer or a string. + // + // If this is true, an empty type is allowed and type as child of anyOf is permitted if following one of the following patterns: + // + // 1) anyOf: + // - type: integer + // - type: string + // 2) allOf: + // - anyOf: + // - type: integer + // - type: string + // - ... zero or more + XKubernetesIntOrString *bool `field:"optional" json:"xKubernetesIntOrString" yaml:"xKubernetesIntOrString"` + // x-kubernetes-list-map-keys annotates an array with the x-kubernetes-list-type `map` by specifying the keys used as the index of the map. + // + // This tag MUST only be used on lists that have the "x-kubernetes-list-type" extension set to "map". Also, the values specified for this attribute must be a scalar typed field of the child structure (no nesting is supported). + // + // The properties specified must either be required or have a default value, to ensure those properties are present for all list items. + XKubernetesListMapKeys *[]*string `field:"optional" json:"xKubernetesListMapKeys" yaml:"xKubernetesListMapKeys"` + // x-kubernetes-list-type annotates an array to further describe its topology. + // + // This extension must only be used on lists and may have 3 possible values: + // + // 1) `atomic`: the list is treated as a single entity, like a scalar. + // Atomic lists will be entirely replaced when updated. This extension + // may be used on any type of list (struct, scalar, ...). + // 2) `set`: + // Sets are lists that must not have multiple items with the same value. Each + // value must be a scalar, an object with x-kubernetes-map-type `atomic` or an + // array with x-kubernetes-list-type `atomic`. + // 3) `map`: + // These lists are like maps in that their elements have a non-index key + // used to identify them. Order is preserved upon merge. The map tag + // must only be used on a list with elements of type object. + // Defaults to atomic for arrays. + // Default: atomic for arrays. + // + XKubernetesListType *string `field:"optional" json:"xKubernetesListType" yaml:"xKubernetesListType"` + // x-kubernetes-map-type annotates an object to further describe its topology. + // + // This extension must only be used when type is object and may have 2 possible values: + // + // 1) `granular`: + // These maps are actual maps (key-value pairs) and each fields are independent + // from each other (they can each be manipulated by separate actors). This is + // the default behaviour for all maps. + // 2) `atomic`: the list is treated as a single entity, like a scalar. + // Atomic maps will be entirely replaced when updated. + XKubernetesMapType *string `field:"optional" json:"xKubernetesMapType" yaml:"xKubernetesMapType"` + // x-kubernetes-preserve-unknown-fields stops the API server decoding step from pruning fields which are not specified in the validation schema. + // + // This affects fields recursively, but switches back to normal pruning behaviour if nested properties or additionalProperties are specified in the schema. This can either be true or undefined. False is forbidden. + XKubernetesPreserveUnknownFields *bool `field:"optional" json:"xKubernetesPreserveUnknownFields" yaml:"xKubernetesPreserveUnknownFields"` + // x-kubernetes-validations describes a list of validation rules written in the CEL expression language. + // + // This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled. + XKubernetesValidations *[]*ValidationRule `field:"optional" json:"xKubernetesValidations" yaml:"xKubernetesValidations"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KeyToPath.go b/examples/cdk8s-sample-deployment/imports/k8s/KeyToPath.go new file mode 100644 index 0000000..f03a15c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KeyToPath.go @@ -0,0 +1,17 @@ +package k8s + + +// Maps a string key to a path within a volume. +type KeyToPath struct { + // key is the key to project. + Key *string `field:"required" json:"key" yaml:"key"` + // path is the relative path of the file to map the key to. + // + // May not be an absolute path. May not contain the path element '..'. May not start with the string '..'. + Path *string `field:"required" json:"path" yaml:"path"` + // mode is Optional: mode bits used to set permissions on this file. + // + // Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + Mode *float64 `field:"optional" json:"mode" yaml:"mode"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeApiService.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiService.go new file mode 100644 index 0000000..559edd1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiService.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// APIService represents a server for a particular GroupVersion. +// +// Name must be "version.group". +type KubeApiService interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeApiService +type jsiiProxy_KubeApiService struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeApiService) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiService) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiService) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiService) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiService) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiService) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiService) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIService" API object. +func NewKubeApiService(scope constructs.Construct, id *string, props *KubeApiServiceProps) KubeApiService { + _init_.Initialize() + + if err := validateNewKubeApiServiceParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeApiService{} + + _jsii_.Create( + "k8s.KubeApiService", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIService" API object. +func NewKubeApiService_Override(k KubeApiService, scope constructs.Construct, id *string, props *KubeApiServiceProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeApiService", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeApiService_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeApiService_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeApiService", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeApiService_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeApiService_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeApiService", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIService". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeApiService_Manifest(props *KubeApiServiceProps) interface{} { + _init_.Initialize() + + if err := validateKubeApiService_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeApiService", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeApiService_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeApiService_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeApiService", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeApiService_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeApiService", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeApiService) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeApiService) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeApiService) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeApiService) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceList.go new file mode 100644 index 0000000..a760714 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// APIServiceList is a list of APIService objects. +type KubeApiServiceList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeApiServiceList +type jsiiProxy_KubeApiServiceList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeApiServiceList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiServiceList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiServiceList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiServiceList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiServiceList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiServiceList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeApiServiceList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceList" API object. +func NewKubeApiServiceList(scope constructs.Construct, id *string, props *KubeApiServiceListProps) KubeApiServiceList { + _init_.Initialize() + + if err := validateNewKubeApiServiceListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeApiServiceList{} + + _jsii_.Create( + "k8s.KubeApiServiceList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceList" API object. +func NewKubeApiServiceList_Override(k KubeApiServiceList, scope constructs.Construct, id *string, props *KubeApiServiceListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeApiServiceList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeApiServiceList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeApiServiceList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeApiServiceList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeApiServiceList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeApiServiceList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeApiServiceList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeApiServiceList_Manifest(props *KubeApiServiceListProps) interface{} { + _init_.Initialize() + + if err := validateKubeApiServiceList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeApiServiceList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeApiServiceList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeApiServiceList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeApiServiceList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeApiServiceList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeApiServiceList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeApiServiceList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeApiServiceList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeApiServiceList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeApiServiceList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceListProps.go new file mode 100644 index 0000000..294cc20 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// APIServiceList is a list of APIService objects. +type KubeApiServiceListProps struct { + // Items is the list of APIService. + Items *[]*KubeApiServiceProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceList__checks.go new file mode 100644 index 0000000..3a64476 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeApiServiceList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeApiServiceList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeApiServiceList_ManifestParameters(props *KubeApiServiceListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeApiServiceList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeApiServiceListParameters(scope constructs.Construct, id *string, props *KubeApiServiceListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceList__no_checks.go new file mode 100644 index 0000000..2db0e7e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeApiServiceList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeApiServiceList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeApiServiceList_ManifestParameters(props *KubeApiServiceListProps) error { + return nil +} + +func validateKubeApiServiceList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeApiServiceListParameters(scope constructs.Construct, id *string, props *KubeApiServiceListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceProps.go new file mode 100644 index 0000000..67017ae --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiServiceProps.go @@ -0,0 +1,15 @@ +package k8s + + +// APIService represents a server for a particular GroupVersion. +// +// Name must be "version.group". +type KubeApiServiceProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec contains information for locating and communicating with a server. + Spec *ApiServiceSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeApiService__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiService__checks.go new file mode 100644 index 0000000..b6e0e7d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiService__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeApiService_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeApiService_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeApiService_ManifestParameters(props *KubeApiServiceProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeApiService_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeApiServiceParameters(scope constructs.Construct, id *string, props *KubeApiServiceProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeApiService__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiService__no_checks.go new file mode 100644 index 0000000..a7a834b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeApiService__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeApiService_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeApiService_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeApiService_ManifestParameters(props *KubeApiServiceProps) error { + return nil +} + +func validateKubeApiService_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeApiServiceParameters(scope constructs.Construct, id *string, props *KubeApiServiceProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeBinding.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeBinding.go new file mode 100644 index 0000000..9300533 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeBinding.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Binding ties one object to another; +// +// for example, a pod is bound to a node by a scheduler. Deprecated in 1.7, please use the bindings subresource of pods instead. +type KubeBinding interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeBinding +type jsiiProxy_KubeBinding struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeBinding) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeBinding) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeBinding) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeBinding) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeBinding) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeBinding) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeBinding) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.Binding" API object. +func NewKubeBinding(scope constructs.Construct, id *string, props *KubeBindingProps) KubeBinding { + _init_.Initialize() + + if err := validateNewKubeBindingParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeBinding{} + + _jsii_.Create( + "k8s.KubeBinding", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.Binding" API object. +func NewKubeBinding_Override(k KubeBinding, scope constructs.Construct, id *string, props *KubeBindingProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeBinding", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeBinding_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeBinding_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeBinding", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeBinding_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeBinding_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeBinding", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.Binding". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeBinding_Manifest(props *KubeBindingProps) interface{} { + _init_.Initialize() + + if err := validateKubeBinding_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeBinding", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeBinding_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeBinding_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeBinding", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeBinding_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeBinding", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeBinding) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeBinding) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeBinding) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeBinding) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeBindingProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeBindingProps.go new file mode 100644 index 0000000..c08d669 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeBindingProps.go @@ -0,0 +1,15 @@ +package k8s + + +// Binding ties one object to another; +// +// for example, a pod is bound to a node by a scheduler. Deprecated in 1.7, please use the bindings subresource of pods instead. +type KubeBindingProps struct { + // The target object that you want to bind to the standard object. + Target *ObjectReference `field:"required" json:"target" yaml:"target"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeBinding__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeBinding__checks.go new file mode 100644 index 0000000..9630497 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeBinding__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeBinding_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeBinding_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeBinding_ManifestParameters(props *KubeBindingProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeBinding_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeBindingParameters(scope constructs.Construct, id *string, props *KubeBindingProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeBinding__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeBinding__no_checks.go new file mode 100644 index 0000000..7f251c8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeBinding__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeBinding_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeBinding_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeBinding_ManifestParameters(props *KubeBindingProps) error { + return nil +} + +func validateKubeBinding_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeBindingParameters(scope constructs.Construct, id *string, props *KubeBindingProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequest.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequest.go new file mode 100644 index 0000000..cceed05 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequest.go @@ -0,0 +1,323 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CertificateSigningRequest objects provide a mechanism to obtain x509 certificates by submitting a certificate signing request, and having it asynchronously approved and issued. +// +// Kubelets use this API to obtain: +// 1. client certificates to authenticate to kube-apiserver (with the "kubernetes.io/kube-apiserver-client-kubelet" signerName). +// 2. serving certificates for TLS endpoints kube-apiserver can connect to securely (with the "kubernetes.io/kubelet-serving" signerName). +// +// This API can be used to request client certificates to authenticate to kube-apiserver (with the "kubernetes.io/kube-apiserver-client" signerName), or to obtain certificates from custom non-Kubernetes signers. +type KubeCertificateSigningRequest interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCertificateSigningRequest +type jsiiProxy_KubeCertificateSigningRequest struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCertificateSigningRequest) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequest) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequest) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequest) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequest) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequest) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequest) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.certificates.v1.CertificateSigningRequest" API object. +func NewKubeCertificateSigningRequest(scope constructs.Construct, id *string, props *KubeCertificateSigningRequestProps) KubeCertificateSigningRequest { + _init_.Initialize() + + if err := validateNewKubeCertificateSigningRequestParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCertificateSigningRequest{} + + _jsii_.Create( + "k8s.KubeCertificateSigningRequest", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.certificates.v1.CertificateSigningRequest" API object. +func NewKubeCertificateSigningRequest_Override(k KubeCertificateSigningRequest, scope constructs.Construct, id *string, props *KubeCertificateSigningRequestProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCertificateSigningRequest", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCertificateSigningRequest_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCertificateSigningRequest_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCertificateSigningRequest", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCertificateSigningRequest_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCertificateSigningRequest_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCertificateSigningRequest", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.certificates.v1.CertificateSigningRequest". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCertificateSigningRequest_Manifest(props *KubeCertificateSigningRequestProps) interface{} { + _init_.Initialize() + + if err := validateKubeCertificateSigningRequest_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCertificateSigningRequest", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCertificateSigningRequest_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCertificateSigningRequest_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCertificateSigningRequest", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCertificateSigningRequest_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCertificateSigningRequest", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCertificateSigningRequest) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCertificateSigningRequest) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCertificateSigningRequest) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCertificateSigningRequest) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestList.go new file mode 100644 index 0000000..3bb48ff --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CertificateSigningRequestList is a collection of CertificateSigningRequest objects. +type KubeCertificateSigningRequestList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCertificateSigningRequestList +type jsiiProxy_KubeCertificateSigningRequestList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCertificateSigningRequestList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequestList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequestList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequestList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequestList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequestList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCertificateSigningRequestList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.certificates.v1.CertificateSigningRequestList" API object. +func NewKubeCertificateSigningRequestList(scope constructs.Construct, id *string, props *KubeCertificateSigningRequestListProps) KubeCertificateSigningRequestList { + _init_.Initialize() + + if err := validateNewKubeCertificateSigningRequestListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCertificateSigningRequestList{} + + _jsii_.Create( + "k8s.KubeCertificateSigningRequestList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.certificates.v1.CertificateSigningRequestList" API object. +func NewKubeCertificateSigningRequestList_Override(k KubeCertificateSigningRequestList, scope constructs.Construct, id *string, props *KubeCertificateSigningRequestListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCertificateSigningRequestList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCertificateSigningRequestList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCertificateSigningRequestList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCertificateSigningRequestList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCertificateSigningRequestList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCertificateSigningRequestList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCertificateSigningRequestList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.certificates.v1.CertificateSigningRequestList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCertificateSigningRequestList_Manifest(props *KubeCertificateSigningRequestListProps) interface{} { + _init_.Initialize() + + if err := validateKubeCertificateSigningRequestList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCertificateSigningRequestList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCertificateSigningRequestList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCertificateSigningRequestList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCertificateSigningRequestList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCertificateSigningRequestList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCertificateSigningRequestList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCertificateSigningRequestList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCertificateSigningRequestList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCertificateSigningRequestList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCertificateSigningRequestList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestListProps.go new file mode 100644 index 0000000..fe28777 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestListProps.go @@ -0,0 +1,10 @@ +package k8s + + +// CertificateSigningRequestList is a collection of CertificateSigningRequest objects. +type KubeCertificateSigningRequestListProps struct { + // items is a collection of CertificateSigningRequest objects. + Items *[]*KubeCertificateSigningRequestProps `field:"required" json:"items" yaml:"items"` + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestList__checks.go new file mode 100644 index 0000000..10b9d45 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCertificateSigningRequestList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCertificateSigningRequestList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCertificateSigningRequestList_ManifestParameters(props *KubeCertificateSigningRequestListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCertificateSigningRequestList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCertificateSigningRequestListParameters(scope constructs.Construct, id *string, props *KubeCertificateSigningRequestListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestList__no_checks.go new file mode 100644 index 0000000..f2919c2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCertificateSigningRequestList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCertificateSigningRequestList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCertificateSigningRequestList_ManifestParameters(props *KubeCertificateSigningRequestListProps) error { + return nil +} + +func validateKubeCertificateSigningRequestList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCertificateSigningRequestListParameters(scope constructs.Construct, id *string, props *KubeCertificateSigningRequestListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestProps.go new file mode 100644 index 0000000..ea98c3e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequestProps.go @@ -0,0 +1,18 @@ +package k8s + + +// CertificateSigningRequest objects provide a mechanism to obtain x509 certificates by submitting a certificate signing request, and having it asynchronously approved and issued. +// +// Kubelets use this API to obtain: +// 1. client certificates to authenticate to kube-apiserver (with the "kubernetes.io/kube-apiserver-client-kubelet" signerName). +// 2. serving certificates for TLS endpoints kube-apiserver can connect to securely (with the "kubernetes.io/kubelet-serving" signerName). +// +// This API can be used to request client certificates to authenticate to kube-apiserver (with the "kubernetes.io/kube-apiserver-client" signerName), or to obtain certificates from custom non-Kubernetes signers. +type KubeCertificateSigningRequestProps struct { + // spec contains the certificate request, and is immutable after creation. + // + // Only the request, signerName, expirationSeconds, and usages fields can be set on creation. Other fields are derived by Kubernetes and cannot be modified by users. + Spec *CertificateSigningRequestSpec `field:"required" json:"spec" yaml:"spec"` + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequest__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequest__checks.go new file mode 100644 index 0000000..86820cf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequest__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCertificateSigningRequest_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCertificateSigningRequest_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCertificateSigningRequest_ManifestParameters(props *KubeCertificateSigningRequestProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCertificateSigningRequest_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCertificateSigningRequestParameters(scope constructs.Construct, id *string, props *KubeCertificateSigningRequestProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequest__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequest__no_checks.go new file mode 100644 index 0000000..07f1e18 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCertificateSigningRequest__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCertificateSigningRequest_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCertificateSigningRequest_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCertificateSigningRequest_ManifestParameters(props *KubeCertificateSigningRequestProps) error { + return nil +} + +func validateKubeCertificateSigningRequest_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCertificateSigningRequestParameters(scope constructs.Construct, id *string, props *KubeCertificateSigningRequestProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1.go new file mode 100644 index 0000000..9650699 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ClusterCIDRList contains a list of ClusterCIDR. +type KubeClusterCidrListV1Alpha1 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeClusterCidrListV1Alpha1 +type jsiiProxy_KubeClusterCidrListV1Alpha1 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeClusterCidrListV1Alpha1) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrListV1Alpha1) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrListV1Alpha1) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrListV1Alpha1) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrListV1Alpha1) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrListV1Alpha1) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrListV1Alpha1) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.networking.v1alpha1.ClusterCIDRList" API object. +func NewKubeClusterCidrListV1Alpha1(scope constructs.Construct, id *string, props *KubeClusterCidrListV1Alpha1Props) KubeClusterCidrListV1Alpha1 { + _init_.Initialize() + + if err := validateNewKubeClusterCidrListV1Alpha1Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeClusterCidrListV1Alpha1{} + + _jsii_.Create( + "k8s.KubeClusterCidrListV1Alpha1", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.networking.v1alpha1.ClusterCIDRList" API object. +func NewKubeClusterCidrListV1Alpha1_Override(k KubeClusterCidrListV1Alpha1, scope constructs.Construct, id *string, props *KubeClusterCidrListV1Alpha1Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeClusterCidrListV1Alpha1", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeClusterCidrListV1Alpha1_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterCidrListV1Alpha1_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterCidrListV1Alpha1", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeClusterCidrListV1Alpha1_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterCidrListV1Alpha1_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterCidrListV1Alpha1", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.networking.v1alpha1.ClusterCIDRList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeClusterCidrListV1Alpha1_Manifest(props *KubeClusterCidrListV1Alpha1Props) interface{} { + _init_.Initialize() + + if err := validateKubeClusterCidrListV1Alpha1_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeClusterCidrListV1Alpha1", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeClusterCidrListV1Alpha1_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeClusterCidrListV1Alpha1_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeClusterCidrListV1Alpha1", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeClusterCidrListV1Alpha1_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeClusterCidrListV1Alpha1", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeClusterCidrListV1Alpha1) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeClusterCidrListV1Alpha1) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeClusterCidrListV1Alpha1) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeClusterCidrListV1Alpha1) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1Props.go new file mode 100644 index 0000000..c56a35b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1Props.go @@ -0,0 +1,13 @@ +package k8s + + +// ClusterCIDRList contains a list of ClusterCIDR. +type KubeClusterCidrListV1Alpha1Props struct { + // Items is the list of ClusterCIDRs. + Items *[]*KubeClusterCidrv1Alpha1Props `field:"required" json:"items" yaml:"items"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1__checks.go new file mode 100644 index 0000000..2269070 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeClusterCidrListV1Alpha1_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterCidrListV1Alpha1_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterCidrListV1Alpha1_ManifestParameters(props *KubeClusterCidrListV1Alpha1Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeClusterCidrListV1Alpha1_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeClusterCidrListV1Alpha1Parameters(scope constructs.Construct, id *string, props *KubeClusterCidrListV1Alpha1Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1__no_checks.go new file mode 100644 index 0000000..f1b9bd4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrListV1Alpha1__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeClusterCidrListV1Alpha1_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeClusterCidrListV1Alpha1_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeClusterCidrListV1Alpha1_ManifestParameters(props *KubeClusterCidrListV1Alpha1Props) error { + return nil +} + +func validateKubeClusterCidrListV1Alpha1_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeClusterCidrListV1Alpha1Parameters(scope constructs.Construct, id *string, props *KubeClusterCidrListV1Alpha1Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1.go new file mode 100644 index 0000000..76b1319 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ClusterCIDR represents a single configuration for per-Node Pod CIDR allocations when the MultiCIDRRangeAllocator is enabled (see the config for kube-controller-manager). +// +// A cluster may have any number of ClusterCIDR resources, all of which will be considered when allocating a CIDR for a Node. A ClusterCIDR is eligible to be used for a given Node when the node selector matches the node in question and has free CIDRs to allocate. In case of multiple matching ClusterCIDR resources, the allocator will attempt to break ties using internal heuristics, but any ClusterCIDR whose node selector matches the Node may be used. +type KubeClusterCidrv1Alpha1 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeClusterCidrv1Alpha1 +type jsiiProxy_KubeClusterCidrv1Alpha1 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeClusterCidrv1Alpha1) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrv1Alpha1) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrv1Alpha1) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrv1Alpha1) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrv1Alpha1) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrv1Alpha1) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterCidrv1Alpha1) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.networking.v1alpha1.ClusterCIDR" API object. +func NewKubeClusterCidrv1Alpha1(scope constructs.Construct, id *string, props *KubeClusterCidrv1Alpha1Props) KubeClusterCidrv1Alpha1 { + _init_.Initialize() + + if err := validateNewKubeClusterCidrv1Alpha1Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeClusterCidrv1Alpha1{} + + _jsii_.Create( + "k8s.KubeClusterCidrv1Alpha1", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.networking.v1alpha1.ClusterCIDR" API object. +func NewKubeClusterCidrv1Alpha1_Override(k KubeClusterCidrv1Alpha1, scope constructs.Construct, id *string, props *KubeClusterCidrv1Alpha1Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeClusterCidrv1Alpha1", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeClusterCidrv1Alpha1_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterCidrv1Alpha1_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterCidrv1Alpha1", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeClusterCidrv1Alpha1_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterCidrv1Alpha1_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterCidrv1Alpha1", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.networking.v1alpha1.ClusterCIDR". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeClusterCidrv1Alpha1_Manifest(props *KubeClusterCidrv1Alpha1Props) interface{} { + _init_.Initialize() + + if err := validateKubeClusterCidrv1Alpha1_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeClusterCidrv1Alpha1", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeClusterCidrv1Alpha1_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeClusterCidrv1Alpha1_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeClusterCidrv1Alpha1", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeClusterCidrv1Alpha1_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeClusterCidrv1Alpha1", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeClusterCidrv1Alpha1) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeClusterCidrv1Alpha1) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeClusterCidrv1Alpha1) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeClusterCidrv1Alpha1) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1Props.go new file mode 100644 index 0000000..8ff390d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1Props.go @@ -0,0 +1,17 @@ +package k8s + + +// ClusterCIDR represents a single configuration for per-Node Pod CIDR allocations when the MultiCIDRRangeAllocator is enabled (see the config for kube-controller-manager). +// +// A cluster may have any number of ClusterCIDR resources, all of which will be considered when allocating a CIDR for a Node. A ClusterCIDR is eligible to be used for a given Node when the node selector matches the node in question and has free CIDRs to allocate. In case of multiple matching ClusterCIDR resources, the allocator will attempt to break ties using internal heuristics, but any ClusterCIDR whose node selector matches the Node may be used. +type KubeClusterCidrv1Alpha1Props struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec is the desired state of the ClusterCIDR. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *ClusterCidrSpecV1Alpha1 `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1__checks.go new file mode 100644 index 0000000..db553d5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeClusterCidrv1Alpha1_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterCidrv1Alpha1_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterCidrv1Alpha1_ManifestParameters(props *KubeClusterCidrv1Alpha1Props) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeClusterCidrv1Alpha1_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeClusterCidrv1Alpha1Parameters(scope constructs.Construct, id *string, props *KubeClusterCidrv1Alpha1Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1__no_checks.go new file mode 100644 index 0000000..15b4d86 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterCidrv1Alpha1__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeClusterCidrv1Alpha1_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeClusterCidrv1Alpha1_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeClusterCidrv1Alpha1_ManifestParameters(props *KubeClusterCidrv1Alpha1Props) error { + return nil +} + +func validateKubeClusterCidrv1Alpha1_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeClusterCidrv1Alpha1Parameters(scope constructs.Construct, id *string, props *KubeClusterCidrv1Alpha1Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRole.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRole.go new file mode 100644 index 0000000..9a21926 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRole.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. +type KubeClusterRole interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeClusterRole +type jsiiProxy_KubeClusterRole struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeClusterRole) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRole) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRole) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRole) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRole) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRole) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRole) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.rbac.v1.ClusterRole" API object. +func NewKubeClusterRole(scope constructs.Construct, id *string, props *KubeClusterRoleProps) KubeClusterRole { + _init_.Initialize() + + if err := validateNewKubeClusterRoleParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeClusterRole{} + + _jsii_.Create( + "k8s.KubeClusterRole", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.rbac.v1.ClusterRole" API object. +func NewKubeClusterRole_Override(k KubeClusterRole, scope constructs.Construct, id *string, props *KubeClusterRoleProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeClusterRole", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeClusterRole_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterRole_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterRole", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeClusterRole_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterRole_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterRole", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.rbac.v1.ClusterRole". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeClusterRole_Manifest(props *KubeClusterRoleProps) interface{} { + _init_.Initialize() + + if err := validateKubeClusterRole_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeClusterRole", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeClusterRole_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeClusterRole_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeClusterRole", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeClusterRole_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeClusterRole", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeClusterRole) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeClusterRole) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeClusterRole) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeClusterRole) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBinding.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBinding.go new file mode 100644 index 0000000..a67688d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBinding.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ClusterRoleBinding references a ClusterRole, but not contain it. +// +// It can reference a ClusterRole in the global namespace, and adds who information via Subject. +type KubeClusterRoleBinding interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeClusterRoleBinding +type jsiiProxy_KubeClusterRoleBinding struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeClusterRoleBinding) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBinding) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBinding) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBinding) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBinding) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBinding) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBinding) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.rbac.v1.ClusterRoleBinding" API object. +func NewKubeClusterRoleBinding(scope constructs.Construct, id *string, props *KubeClusterRoleBindingProps) KubeClusterRoleBinding { + _init_.Initialize() + + if err := validateNewKubeClusterRoleBindingParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeClusterRoleBinding{} + + _jsii_.Create( + "k8s.KubeClusterRoleBinding", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.rbac.v1.ClusterRoleBinding" API object. +func NewKubeClusterRoleBinding_Override(k KubeClusterRoleBinding, scope constructs.Construct, id *string, props *KubeClusterRoleBindingProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeClusterRoleBinding", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeClusterRoleBinding_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterRoleBinding_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleBinding", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeClusterRoleBinding_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterRoleBinding_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleBinding", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.rbac.v1.ClusterRoleBinding". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeClusterRoleBinding_Manifest(props *KubeClusterRoleBindingProps) interface{} { + _init_.Initialize() + + if err := validateKubeClusterRoleBinding_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleBinding", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeClusterRoleBinding_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeClusterRoleBinding_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleBinding", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeClusterRoleBinding_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeClusterRoleBinding", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeClusterRoleBinding) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeClusterRoleBinding) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeClusterRoleBinding) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeClusterRoleBinding) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingList.go new file mode 100644 index 0000000..b6c3cbb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ClusterRoleBindingList is a collection of ClusterRoleBindings. +type KubeClusterRoleBindingList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeClusterRoleBindingList +type jsiiProxy_KubeClusterRoleBindingList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeClusterRoleBindingList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBindingList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBindingList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBindingList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBindingList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBindingList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleBindingList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.rbac.v1.ClusterRoleBindingList" API object. +func NewKubeClusterRoleBindingList(scope constructs.Construct, id *string, props *KubeClusterRoleBindingListProps) KubeClusterRoleBindingList { + _init_.Initialize() + + if err := validateNewKubeClusterRoleBindingListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeClusterRoleBindingList{} + + _jsii_.Create( + "k8s.KubeClusterRoleBindingList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.rbac.v1.ClusterRoleBindingList" API object. +func NewKubeClusterRoleBindingList_Override(k KubeClusterRoleBindingList, scope constructs.Construct, id *string, props *KubeClusterRoleBindingListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeClusterRoleBindingList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeClusterRoleBindingList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterRoleBindingList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleBindingList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeClusterRoleBindingList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterRoleBindingList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleBindingList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.rbac.v1.ClusterRoleBindingList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeClusterRoleBindingList_Manifest(props *KubeClusterRoleBindingListProps) interface{} { + _init_.Initialize() + + if err := validateKubeClusterRoleBindingList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleBindingList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeClusterRoleBindingList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeClusterRoleBindingList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleBindingList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeClusterRoleBindingList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeClusterRoleBindingList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeClusterRoleBindingList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeClusterRoleBindingList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeClusterRoleBindingList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeClusterRoleBindingList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingListProps.go new file mode 100644 index 0000000..911449f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// ClusterRoleBindingList is a collection of ClusterRoleBindings. +type KubeClusterRoleBindingListProps struct { + // Items is a list of ClusterRoleBindings. + Items *[]*KubeClusterRoleBindingProps `field:"required" json:"items" yaml:"items"` + // Standard object's metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingList__checks.go new file mode 100644 index 0000000..d261f94 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeClusterRoleBindingList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterRoleBindingList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterRoleBindingList_ManifestParameters(props *KubeClusterRoleBindingListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeClusterRoleBindingList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeClusterRoleBindingListParameters(scope constructs.Construct, id *string, props *KubeClusterRoleBindingListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingList__no_checks.go new file mode 100644 index 0000000..832069b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeClusterRoleBindingList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeClusterRoleBindingList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeClusterRoleBindingList_ManifestParameters(props *KubeClusterRoleBindingListProps) error { + return nil +} + +func validateKubeClusterRoleBindingList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeClusterRoleBindingListParameters(scope constructs.Construct, id *string, props *KubeClusterRoleBindingListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingProps.go new file mode 100644 index 0000000..cf411d2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBindingProps.go @@ -0,0 +1,17 @@ +package k8s + + +// ClusterRoleBinding references a ClusterRole, but not contain it. +// +// It can reference a ClusterRole in the global namespace, and adds who information via Subject. +type KubeClusterRoleBindingProps struct { + // RoleRef can only reference a ClusterRole in the global namespace. + // + // If the RoleRef cannot be resolved, the Authorizer must return an error. + RoleRef *RoleRef `field:"required" json:"roleRef" yaml:"roleRef"` + // Standard object's metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Subjects holds references to the objects the role applies to. + Subjects *[]*Subject `field:"optional" json:"subjects" yaml:"subjects"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBinding__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBinding__checks.go new file mode 100644 index 0000000..869403a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBinding__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeClusterRoleBinding_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterRoleBinding_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterRoleBinding_ManifestParameters(props *KubeClusterRoleBindingProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeClusterRoleBinding_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeClusterRoleBindingParameters(scope constructs.Construct, id *string, props *KubeClusterRoleBindingProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBinding__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBinding__no_checks.go new file mode 100644 index 0000000..2cffab1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleBinding__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeClusterRoleBinding_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeClusterRoleBinding_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeClusterRoleBinding_ManifestParameters(props *KubeClusterRoleBindingProps) error { + return nil +} + +func validateKubeClusterRoleBinding_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeClusterRoleBindingParameters(scope constructs.Construct, id *string, props *KubeClusterRoleBindingProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleList.go new file mode 100644 index 0000000..f390cd5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ClusterRoleList is a collection of ClusterRoles. +type KubeClusterRoleList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeClusterRoleList +type jsiiProxy_KubeClusterRoleList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeClusterRoleList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeClusterRoleList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.rbac.v1.ClusterRoleList" API object. +func NewKubeClusterRoleList(scope constructs.Construct, id *string, props *KubeClusterRoleListProps) KubeClusterRoleList { + _init_.Initialize() + + if err := validateNewKubeClusterRoleListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeClusterRoleList{} + + _jsii_.Create( + "k8s.KubeClusterRoleList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.rbac.v1.ClusterRoleList" API object. +func NewKubeClusterRoleList_Override(k KubeClusterRoleList, scope constructs.Construct, id *string, props *KubeClusterRoleListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeClusterRoleList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeClusterRoleList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterRoleList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeClusterRoleList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeClusterRoleList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.rbac.v1.ClusterRoleList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeClusterRoleList_Manifest(props *KubeClusterRoleListProps) interface{} { + _init_.Initialize() + + if err := validateKubeClusterRoleList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeClusterRoleList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeClusterRoleList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeClusterRoleList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeClusterRoleList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeClusterRoleList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeClusterRoleList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeClusterRoleList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeClusterRoleList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeClusterRoleList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleListProps.go new file mode 100644 index 0000000..9b46771 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// ClusterRoleList is a collection of ClusterRoles. +type KubeClusterRoleListProps struct { + // Items is a list of ClusterRoles. + Items *[]*KubeClusterRoleProps `field:"required" json:"items" yaml:"items"` + // Standard object's metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleList__checks.go new file mode 100644 index 0000000..312bc83 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeClusterRoleList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterRoleList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterRoleList_ManifestParameters(props *KubeClusterRoleListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeClusterRoleList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeClusterRoleListParameters(scope constructs.Construct, id *string, props *KubeClusterRoleListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleList__no_checks.go new file mode 100644 index 0000000..91cad98 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeClusterRoleList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeClusterRoleList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeClusterRoleList_ManifestParameters(props *KubeClusterRoleListProps) error { + return nil +} + +func validateKubeClusterRoleList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeClusterRoleListParameters(scope constructs.Construct, id *string, props *KubeClusterRoleListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleProps.go new file mode 100644 index 0000000..b2dc7b9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRoleProps.go @@ -0,0 +1,15 @@ +package k8s + + +// ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. +type KubeClusterRoleProps struct { + // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. + // + // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller. + AggregationRule *AggregationRule `field:"optional" json:"aggregationRule" yaml:"aggregationRule"` + // Standard object's metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Rules holds all the PolicyRules for this ClusterRole. + Rules *[]*PolicyRule `field:"optional" json:"rules" yaml:"rules"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRole__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRole__checks.go new file mode 100644 index 0000000..4813b7c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRole__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeClusterRole_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterRole_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeClusterRole_ManifestParameters(props *KubeClusterRoleProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeClusterRole_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeClusterRoleParameters(scope constructs.Construct, id *string, props *KubeClusterRoleProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRole__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRole__no_checks.go new file mode 100644 index 0000000..b83139d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeClusterRole__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeClusterRole_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeClusterRole_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeClusterRole_ManifestParameters(props *KubeClusterRoleProps) error { + return nil +} + +func validateKubeClusterRole_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeClusterRoleParameters(scope constructs.Construct, id *string, props *KubeClusterRoleProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatus.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatus.go new file mode 100644 index 0000000..272a9ad --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatus.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ComponentStatus (and ComponentStatusList) holds the cluster validation info. +// +// Deprecated: This API is deprecated in v1.19+ +type KubeComponentStatus interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeComponentStatus +type jsiiProxy_KubeComponentStatus struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeComponentStatus) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatus) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatus) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatus) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatus) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatus) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatus) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ComponentStatus" API object. +func NewKubeComponentStatus(scope constructs.Construct, id *string, props *KubeComponentStatusProps) KubeComponentStatus { + _init_.Initialize() + + if err := validateNewKubeComponentStatusParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeComponentStatus{} + + _jsii_.Create( + "k8s.KubeComponentStatus", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ComponentStatus" API object. +func NewKubeComponentStatus_Override(k KubeComponentStatus, scope constructs.Construct, id *string, props *KubeComponentStatusProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeComponentStatus", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeComponentStatus_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeComponentStatus_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeComponentStatus", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeComponentStatus_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeComponentStatus_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeComponentStatus", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ComponentStatus". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeComponentStatus_Manifest(props *KubeComponentStatusProps) interface{} { + _init_.Initialize() + + if err := validateKubeComponentStatus_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeComponentStatus", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeComponentStatus_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeComponentStatus_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeComponentStatus", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeComponentStatus_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeComponentStatus", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeComponentStatus) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeComponentStatus) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeComponentStatus) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeComponentStatus) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusList.go new file mode 100644 index 0000000..9afd087 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusList.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Status of all the conditions for the component as a list of ComponentStatus objects. +// +// Deprecated: This API is deprecated in v1.19+ +type KubeComponentStatusList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeComponentStatusList +type jsiiProxy_KubeComponentStatusList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeComponentStatusList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatusList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatusList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatusList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatusList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatusList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeComponentStatusList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ComponentStatusList" API object. +func NewKubeComponentStatusList(scope constructs.Construct, id *string, props *KubeComponentStatusListProps) KubeComponentStatusList { + _init_.Initialize() + + if err := validateNewKubeComponentStatusListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeComponentStatusList{} + + _jsii_.Create( + "k8s.KubeComponentStatusList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ComponentStatusList" API object. +func NewKubeComponentStatusList_Override(k KubeComponentStatusList, scope constructs.Construct, id *string, props *KubeComponentStatusListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeComponentStatusList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeComponentStatusList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeComponentStatusList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeComponentStatusList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeComponentStatusList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeComponentStatusList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeComponentStatusList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ComponentStatusList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeComponentStatusList_Manifest(props *KubeComponentStatusListProps) interface{} { + _init_.Initialize() + + if err := validateKubeComponentStatusList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeComponentStatusList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeComponentStatusList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeComponentStatusList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeComponentStatusList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeComponentStatusList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeComponentStatusList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeComponentStatusList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeComponentStatusList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeComponentStatusList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeComponentStatusList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusListProps.go new file mode 100644 index 0000000..3c5cd05 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// Status of all the conditions for the component as a list of ComponentStatus objects. +// +// Deprecated: This API is deprecated in v1.19+ +type KubeComponentStatusListProps struct { + // List of ComponentStatus objects. + Items *[]*KubeComponentStatusProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusList__checks.go new file mode 100644 index 0000000..7153b53 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeComponentStatusList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeComponentStatusList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeComponentStatusList_ManifestParameters(props *KubeComponentStatusListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeComponentStatusList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeComponentStatusListParameters(scope constructs.Construct, id *string, props *KubeComponentStatusListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusList__no_checks.go new file mode 100644 index 0000000..1bdd6ee --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeComponentStatusList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeComponentStatusList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeComponentStatusList_ManifestParameters(props *KubeComponentStatusListProps) error { + return nil +} + +func validateKubeComponentStatusList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeComponentStatusListParameters(scope constructs.Construct, id *string, props *KubeComponentStatusListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusProps.go new file mode 100644 index 0000000..849dcbe --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatusProps.go @@ -0,0 +1,15 @@ +package k8s + + +// ComponentStatus (and ComponentStatusList) holds the cluster validation info. +// +// Deprecated: This API is deprecated in v1.19+ +type KubeComponentStatusProps struct { + // List of component conditions observed. + Conditions *[]*ComponentCondition `field:"optional" json:"conditions" yaml:"conditions"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatus__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatus__checks.go new file mode 100644 index 0000000..0085a5a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatus__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeComponentStatus_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeComponentStatus_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeComponentStatus_ManifestParameters(props *KubeComponentStatusProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeComponentStatus_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeComponentStatusParameters(scope constructs.Construct, id *string, props *KubeComponentStatusProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatus__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatus__no_checks.go new file mode 100644 index 0000000..05d507d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeComponentStatus__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeComponentStatus_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeComponentStatus_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeComponentStatus_ManifestParameters(props *KubeComponentStatusProps) error { + return nil +} + +func validateKubeComponentStatus_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeComponentStatusParameters(scope constructs.Construct, id *string, props *KubeComponentStatusProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMap.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMap.go new file mode 100644 index 0000000..3b1a191 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMap.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ConfigMap holds configuration data for pods to consume. +type KubeConfigMap interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeConfigMap +type jsiiProxy_KubeConfigMap struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeConfigMap) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMap) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMap) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMap) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMap) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMap) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMap) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ConfigMap" API object. +func NewKubeConfigMap(scope constructs.Construct, id *string, props *KubeConfigMapProps) KubeConfigMap { + _init_.Initialize() + + if err := validateNewKubeConfigMapParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeConfigMap{} + + _jsii_.Create( + "k8s.KubeConfigMap", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ConfigMap" API object. +func NewKubeConfigMap_Override(k KubeConfigMap, scope constructs.Construct, id *string, props *KubeConfigMapProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeConfigMap", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeConfigMap_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeConfigMap_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeConfigMap", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeConfigMap_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeConfigMap_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeConfigMap", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ConfigMap". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeConfigMap_Manifest(props *KubeConfigMapProps) interface{} { + _init_.Initialize() + + if err := validateKubeConfigMap_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeConfigMap", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeConfigMap_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeConfigMap_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeConfigMap", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeConfigMap_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeConfigMap", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeConfigMap) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeConfigMap) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeConfigMap) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeConfigMap) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapList.go new file mode 100644 index 0000000..34b423b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ConfigMapList is a resource containing a list of ConfigMap objects. +type KubeConfigMapList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeConfigMapList +type jsiiProxy_KubeConfigMapList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeConfigMapList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMapList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMapList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMapList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMapList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMapList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeConfigMapList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ConfigMapList" API object. +func NewKubeConfigMapList(scope constructs.Construct, id *string, props *KubeConfigMapListProps) KubeConfigMapList { + _init_.Initialize() + + if err := validateNewKubeConfigMapListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeConfigMapList{} + + _jsii_.Create( + "k8s.KubeConfigMapList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ConfigMapList" API object. +func NewKubeConfigMapList_Override(k KubeConfigMapList, scope constructs.Construct, id *string, props *KubeConfigMapListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeConfigMapList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeConfigMapList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeConfigMapList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeConfigMapList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeConfigMapList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeConfigMapList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeConfigMapList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ConfigMapList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeConfigMapList_Manifest(props *KubeConfigMapListProps) interface{} { + _init_.Initialize() + + if err := validateKubeConfigMapList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeConfigMapList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeConfigMapList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeConfigMapList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeConfigMapList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeConfigMapList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeConfigMapList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeConfigMapList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeConfigMapList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeConfigMapList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeConfigMapList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapListProps.go new file mode 100644 index 0000000..4877c90 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// ConfigMapList is a resource containing a list of ConfigMap objects. +type KubeConfigMapListProps struct { + // Items is the list of ConfigMaps. + Items *[]*KubeConfigMapProps `field:"required" json:"items" yaml:"items"` + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapList__checks.go new file mode 100644 index 0000000..ce4658a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeConfigMapList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeConfigMapList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeConfigMapList_ManifestParameters(props *KubeConfigMapListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeConfigMapList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeConfigMapListParameters(scope constructs.Construct, id *string, props *KubeConfigMapListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapList__no_checks.go new file mode 100644 index 0000000..f546b07 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeConfigMapList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeConfigMapList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeConfigMapList_ManifestParameters(props *KubeConfigMapListProps) error { + return nil +} + +func validateKubeConfigMapList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeConfigMapListParameters(scope constructs.Construct, id *string, props *KubeConfigMapListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapProps.go new file mode 100644 index 0000000..fd8bee5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMapProps.go @@ -0,0 +1,23 @@ +package k8s + + +// ConfigMap holds configuration data for pods to consume. +type KubeConfigMapProps struct { + // BinaryData contains the binary data. + // + // Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + BinaryData *map[string]*string `field:"optional" json:"binaryData" yaml:"binaryData"` + // Data contains the configuration data. + // + // Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + Data *map[string]*string `field:"optional" json:"data" yaml:"data"` + // Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). + // + // If not set to true, the field can be modified at any time. Defaulted to nil. + Immutable *bool `field:"optional" json:"immutable" yaml:"immutable"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMap__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMap__checks.go new file mode 100644 index 0000000..1926658 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMap__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeConfigMap_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeConfigMap_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeConfigMap_ManifestParameters(props *KubeConfigMapProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeConfigMap_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeConfigMapParameters(scope constructs.Construct, id *string, props *KubeConfigMapProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMap__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMap__no_checks.go new file mode 100644 index 0000000..00487d0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeConfigMap__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeConfigMap_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeConfigMap_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeConfigMap_ManifestParameters(props *KubeConfigMapProps) error { + return nil +} + +func validateKubeConfigMap_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeConfigMapParameters(scope constructs.Construct, id *string, props *KubeConfigMapProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevision.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevision.go new file mode 100644 index 0000000..d1d91a7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevision.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ControllerRevision implements an immutable snapshot of state data. +// +// Clients are responsible for serializing and deserializing the objects that contain their internal state. Once a ControllerRevision has been successfully created, it can not be updated. The API Server will fail validation of all requests that attempt to mutate the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However, it may be subject to name and representation changes in future releases, and clients should not depend on its stability. It is primarily for internal use by controllers. +type KubeControllerRevision interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeControllerRevision +type jsiiProxy_KubeControllerRevision struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeControllerRevision) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevision) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevision) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevision) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevision) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevision) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevision) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apps.v1.ControllerRevision" API object. +func NewKubeControllerRevision(scope constructs.Construct, id *string, props *KubeControllerRevisionProps) KubeControllerRevision { + _init_.Initialize() + + if err := validateNewKubeControllerRevisionParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeControllerRevision{} + + _jsii_.Create( + "k8s.KubeControllerRevision", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apps.v1.ControllerRevision" API object. +func NewKubeControllerRevision_Override(k KubeControllerRevision, scope constructs.Construct, id *string, props *KubeControllerRevisionProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeControllerRevision", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeControllerRevision_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeControllerRevision_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeControllerRevision", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeControllerRevision_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeControllerRevision_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeControllerRevision", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apps.v1.ControllerRevision". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeControllerRevision_Manifest(props *KubeControllerRevisionProps) interface{} { + _init_.Initialize() + + if err := validateKubeControllerRevision_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeControllerRevision", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeControllerRevision_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeControllerRevision_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeControllerRevision", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeControllerRevision_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeControllerRevision", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeControllerRevision) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeControllerRevision) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeControllerRevision) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeControllerRevision) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionList.go new file mode 100644 index 0000000..266c8ef --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ControllerRevisionList is a resource containing a list of ControllerRevision objects. +type KubeControllerRevisionList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeControllerRevisionList +type jsiiProxy_KubeControllerRevisionList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeControllerRevisionList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevisionList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevisionList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevisionList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevisionList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevisionList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeControllerRevisionList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apps.v1.ControllerRevisionList" API object. +func NewKubeControllerRevisionList(scope constructs.Construct, id *string, props *KubeControllerRevisionListProps) KubeControllerRevisionList { + _init_.Initialize() + + if err := validateNewKubeControllerRevisionListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeControllerRevisionList{} + + _jsii_.Create( + "k8s.KubeControllerRevisionList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apps.v1.ControllerRevisionList" API object. +func NewKubeControllerRevisionList_Override(k KubeControllerRevisionList, scope constructs.Construct, id *string, props *KubeControllerRevisionListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeControllerRevisionList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeControllerRevisionList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeControllerRevisionList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeControllerRevisionList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeControllerRevisionList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeControllerRevisionList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeControllerRevisionList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apps.v1.ControllerRevisionList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeControllerRevisionList_Manifest(props *KubeControllerRevisionListProps) interface{} { + _init_.Initialize() + + if err := validateKubeControllerRevisionList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeControllerRevisionList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeControllerRevisionList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeControllerRevisionList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeControllerRevisionList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeControllerRevisionList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeControllerRevisionList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeControllerRevisionList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeControllerRevisionList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeControllerRevisionList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeControllerRevisionList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionListProps.go new file mode 100644 index 0000000..138673c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// ControllerRevisionList is a resource containing a list of ControllerRevision objects. +type KubeControllerRevisionListProps struct { + // Items is the list of ControllerRevisions. + Items *[]*KubeControllerRevisionProps `field:"required" json:"items" yaml:"items"` + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionList__checks.go new file mode 100644 index 0000000..c974688 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeControllerRevisionList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeControllerRevisionList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeControllerRevisionList_ManifestParameters(props *KubeControllerRevisionListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeControllerRevisionList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeControllerRevisionListParameters(scope constructs.Construct, id *string, props *KubeControllerRevisionListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionList__no_checks.go new file mode 100644 index 0000000..664184e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeControllerRevisionList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeControllerRevisionList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeControllerRevisionList_ManifestParameters(props *KubeControllerRevisionListProps) error { + return nil +} + +func validateKubeControllerRevisionList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeControllerRevisionListParameters(scope constructs.Construct, id *string, props *KubeControllerRevisionListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionProps.go new file mode 100644 index 0000000..7c3e411 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevisionProps.go @@ -0,0 +1,17 @@ +package k8s + + +// ControllerRevision implements an immutable snapshot of state data. +// +// Clients are responsible for serializing and deserializing the objects that contain their internal state. Once a ControllerRevision has been successfully created, it can not be updated. The API Server will fail validation of all requests that attempt to mutate the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However, it may be subject to name and representation changes in future releases, and clients should not depend on its stability. It is primarily for internal use by controllers. +type KubeControllerRevisionProps struct { + // Revision indicates the revision of the state represented by Data. + Revision *float64 `field:"required" json:"revision" yaml:"revision"` + // Data is the serialized representation of the state. + Data interface{} `field:"optional" json:"data" yaml:"data"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevision__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevision__checks.go new file mode 100644 index 0000000..a7cc5ab --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevision__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeControllerRevision_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeControllerRevision_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeControllerRevision_ManifestParameters(props *KubeControllerRevisionProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeControllerRevision_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeControllerRevisionParameters(scope constructs.Construct, id *string, props *KubeControllerRevisionProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevision__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevision__no_checks.go new file mode 100644 index 0000000..2583eb3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeControllerRevision__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeControllerRevision_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeControllerRevision_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeControllerRevision_ManifestParameters(props *KubeControllerRevisionProps) error { + return nil +} + +func validateKubeControllerRevision_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeControllerRevisionParameters(scope constructs.Construct, id *string, props *KubeControllerRevisionProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJob.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJob.go new file mode 100644 index 0000000..60ebf40 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJob.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CronJob represents the configuration of a single cron job. +type KubeCronJob interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCronJob +type jsiiProxy_KubeCronJob struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCronJob) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJob) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJob) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJob) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJob) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJob) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJob) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.batch.v1.CronJob" API object. +func NewKubeCronJob(scope constructs.Construct, id *string, props *KubeCronJobProps) KubeCronJob { + _init_.Initialize() + + if err := validateNewKubeCronJobParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCronJob{} + + _jsii_.Create( + "k8s.KubeCronJob", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.batch.v1.CronJob" API object. +func NewKubeCronJob_Override(k KubeCronJob, scope constructs.Construct, id *string, props *KubeCronJobProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCronJob", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCronJob_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCronJob_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCronJob", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCronJob_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCronJob_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCronJob", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.batch.v1.CronJob". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCronJob_Manifest(props *KubeCronJobProps) interface{} { + _init_.Initialize() + + if err := validateKubeCronJob_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCronJob", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCronJob_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCronJob_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCronJob", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCronJob_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCronJob", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCronJob) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCronJob) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCronJob) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCronJob) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobList.go new file mode 100644 index 0000000..217d542 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CronJobList is a collection of cron jobs. +type KubeCronJobList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCronJobList +type jsiiProxy_KubeCronJobList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCronJobList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJobList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJobList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJobList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJobList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJobList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCronJobList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.batch.v1.CronJobList" API object. +func NewKubeCronJobList(scope constructs.Construct, id *string, props *KubeCronJobListProps) KubeCronJobList { + _init_.Initialize() + + if err := validateNewKubeCronJobListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCronJobList{} + + _jsii_.Create( + "k8s.KubeCronJobList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.batch.v1.CronJobList" API object. +func NewKubeCronJobList_Override(k KubeCronJobList, scope constructs.Construct, id *string, props *KubeCronJobListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCronJobList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCronJobList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCronJobList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCronJobList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCronJobList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCronJobList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCronJobList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.batch.v1.CronJobList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCronJobList_Manifest(props *KubeCronJobListProps) interface{} { + _init_.Initialize() + + if err := validateKubeCronJobList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCronJobList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCronJobList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCronJobList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCronJobList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCronJobList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCronJobList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCronJobList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCronJobList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCronJobList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCronJobList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobListProps.go new file mode 100644 index 0000000..737b787 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// CronJobList is a collection of cron jobs. +type KubeCronJobListProps struct { + // items is the list of CronJobs. + Items *[]*KubeCronJobProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobList__checks.go new file mode 100644 index 0000000..8a130da --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCronJobList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCronJobList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCronJobList_ManifestParameters(props *KubeCronJobListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCronJobList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCronJobListParameters(scope constructs.Construct, id *string, props *KubeCronJobListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobList__no_checks.go new file mode 100644 index 0000000..804fcdc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCronJobList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCronJobList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCronJobList_ManifestParameters(props *KubeCronJobListProps) error { + return nil +} + +func validateKubeCronJobList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCronJobListParameters(scope constructs.Construct, id *string, props *KubeCronJobListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobProps.go new file mode 100644 index 0000000..e243da6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJobProps.go @@ -0,0 +1,15 @@ +package k8s + + +// CronJob represents the configuration of a single cron job. +type KubeCronJobProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Specification of the desired behavior of a cron job, including the schedule. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *CronJobSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJob__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJob__checks.go new file mode 100644 index 0000000..1d39a30 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJob__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCronJob_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCronJob_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCronJob_ManifestParameters(props *KubeCronJobProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCronJob_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCronJobParameters(scope constructs.Construct, id *string, props *KubeCronJobProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJob__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJob__no_checks.go new file mode 100644 index 0000000..5c3f7a4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCronJob__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCronJob_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCronJob_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCronJob_ManifestParameters(props *KubeCronJobProps) error { + return nil +} + +func validateKubeCronJob_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCronJobParameters(scope constructs.Construct, id *string, props *KubeCronJobProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriver.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriver.go new file mode 100644 index 0000000..f89e185 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriver.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CSIDriver captures information about a Container Storage Interface (CSI) volume driver deployed on the cluster. +// +// Kubernetes attach detach controller uses this object to determine whether attach is required. Kubelet uses this object to determine whether pod information needs to be passed on mount. CSIDriver objects are non-namespaced. +type KubeCsiDriver interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCsiDriver +type jsiiProxy_KubeCsiDriver struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCsiDriver) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriver) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriver) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriver) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriver) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriver) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriver) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1.CSIDriver" API object. +func NewKubeCsiDriver(scope constructs.Construct, id *string, props *KubeCsiDriverProps) KubeCsiDriver { + _init_.Initialize() + + if err := validateNewKubeCsiDriverParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCsiDriver{} + + _jsii_.Create( + "k8s.KubeCsiDriver", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1.CSIDriver" API object. +func NewKubeCsiDriver_Override(k KubeCsiDriver, scope constructs.Construct, id *string, props *KubeCsiDriverProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCsiDriver", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCsiDriver_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiDriver_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiDriver", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCsiDriver_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiDriver_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiDriver", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1.CSIDriver". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCsiDriver_Manifest(props *KubeCsiDriverProps) interface{} { + _init_.Initialize() + + if err := validateKubeCsiDriver_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCsiDriver", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCsiDriver_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCsiDriver_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCsiDriver", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCsiDriver_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCsiDriver", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCsiDriver) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCsiDriver) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCsiDriver) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCsiDriver) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverList.go new file mode 100644 index 0000000..7e9bdcc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CSIDriverList is a collection of CSIDriver objects. +type KubeCsiDriverList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCsiDriverList +type jsiiProxy_KubeCsiDriverList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCsiDriverList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriverList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriverList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriverList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriverList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriverList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiDriverList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1.CSIDriverList" API object. +func NewKubeCsiDriverList(scope constructs.Construct, id *string, props *KubeCsiDriverListProps) KubeCsiDriverList { + _init_.Initialize() + + if err := validateNewKubeCsiDriverListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCsiDriverList{} + + _jsii_.Create( + "k8s.KubeCsiDriverList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1.CSIDriverList" API object. +func NewKubeCsiDriverList_Override(k KubeCsiDriverList, scope constructs.Construct, id *string, props *KubeCsiDriverListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCsiDriverList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCsiDriverList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiDriverList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiDriverList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCsiDriverList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiDriverList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiDriverList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1.CSIDriverList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCsiDriverList_Manifest(props *KubeCsiDriverListProps) interface{} { + _init_.Initialize() + + if err := validateKubeCsiDriverList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCsiDriverList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCsiDriverList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCsiDriverList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCsiDriverList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCsiDriverList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCsiDriverList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCsiDriverList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCsiDriverList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCsiDriverList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCsiDriverList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverListProps.go new file mode 100644 index 0000000..0dfe81c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// CSIDriverList is a collection of CSIDriver objects. +type KubeCsiDriverListProps struct { + // items is the list of CSIDriver. + Items *[]*KubeCsiDriverProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverList__checks.go new file mode 100644 index 0000000..f8cf32e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCsiDriverList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiDriverList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiDriverList_ManifestParameters(props *KubeCsiDriverListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCsiDriverList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCsiDriverListParameters(scope constructs.Construct, id *string, props *KubeCsiDriverListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverList__no_checks.go new file mode 100644 index 0000000..6d21194 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCsiDriverList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCsiDriverList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCsiDriverList_ManifestParameters(props *KubeCsiDriverListProps) error { + return nil +} + +func validateKubeCsiDriverList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCsiDriverListParameters(scope constructs.Construct, id *string, props *KubeCsiDriverListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverProps.go new file mode 100644 index 0000000..416887a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriverProps.go @@ -0,0 +1,15 @@ +package k8s + + +// CSIDriver captures information about a Container Storage Interface (CSI) volume driver deployed on the cluster. +// +// Kubernetes attach detach controller uses this object to determine whether attach is required. Kubelet uses this object to determine whether pod information needs to be passed on mount. CSIDriver objects are non-namespaced. +type KubeCsiDriverProps struct { + // Specification of the CSI Driver. + Spec *CsiDriverSpec `field:"required" json:"spec" yaml:"spec"` + // Standard object metadata. + // + // metadata.Name indicates the name of the CSI driver that this object refers to; it MUST be the same name returned by the CSI GetPluginName() call for that driver. The driver name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), dots (.), and alphanumerics between. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriver__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriver__checks.go new file mode 100644 index 0000000..d629f17 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriver__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCsiDriver_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiDriver_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiDriver_ManifestParameters(props *KubeCsiDriverProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCsiDriver_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCsiDriverParameters(scope constructs.Construct, id *string, props *KubeCsiDriverProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriver__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriver__no_checks.go new file mode 100644 index 0000000..a5ecdbb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiDriver__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCsiDriver_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCsiDriver_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCsiDriver_ManifestParameters(props *KubeCsiDriverProps) error { + return nil +} + +func validateKubeCsiDriver_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCsiDriverParameters(scope constructs.Construct, id *string, props *KubeCsiDriverProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNode.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNode.go new file mode 100644 index 0000000..e77ea81 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNode.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CSINode holds information about all CSI drivers installed on a node. +// +// CSI drivers do not need to create the CSINode object directly. As long as they use the node-driver-registrar sidecar container, the kubelet will automatically populate the CSINode object for the CSI driver as part of kubelet plugin registration. CSINode has the same name as a node. If the object is missing, it means either there are no CSI Drivers available on the node, or the Kubelet version is low enough that it doesn't create this object. CSINode has an OwnerReference that points to the corresponding node object. +type KubeCsiNode interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCsiNode +type jsiiProxy_KubeCsiNode struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCsiNode) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNode) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNode) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNode) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNode) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNode) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNode) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1.CSINode" API object. +func NewKubeCsiNode(scope constructs.Construct, id *string, props *KubeCsiNodeProps) KubeCsiNode { + _init_.Initialize() + + if err := validateNewKubeCsiNodeParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCsiNode{} + + _jsii_.Create( + "k8s.KubeCsiNode", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1.CSINode" API object. +func NewKubeCsiNode_Override(k KubeCsiNode, scope constructs.Construct, id *string, props *KubeCsiNodeProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCsiNode", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCsiNode_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiNode_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiNode", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCsiNode_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiNode_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiNode", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1.CSINode". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCsiNode_Manifest(props *KubeCsiNodeProps) interface{} { + _init_.Initialize() + + if err := validateKubeCsiNode_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCsiNode", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCsiNode_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCsiNode_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCsiNode", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCsiNode_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCsiNode", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCsiNode) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCsiNode) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCsiNode) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCsiNode) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeList.go new file mode 100644 index 0000000..f3f3d0f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CSINodeList is a collection of CSINode objects. +type KubeCsiNodeList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCsiNodeList +type jsiiProxy_KubeCsiNodeList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCsiNodeList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNodeList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNodeList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNodeList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNodeList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNodeList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiNodeList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1.CSINodeList" API object. +func NewKubeCsiNodeList(scope constructs.Construct, id *string, props *KubeCsiNodeListProps) KubeCsiNodeList { + _init_.Initialize() + + if err := validateNewKubeCsiNodeListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCsiNodeList{} + + _jsii_.Create( + "k8s.KubeCsiNodeList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1.CSINodeList" API object. +func NewKubeCsiNodeList_Override(k KubeCsiNodeList, scope constructs.Construct, id *string, props *KubeCsiNodeListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCsiNodeList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCsiNodeList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiNodeList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiNodeList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCsiNodeList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiNodeList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiNodeList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1.CSINodeList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCsiNodeList_Manifest(props *KubeCsiNodeListProps) interface{} { + _init_.Initialize() + + if err := validateKubeCsiNodeList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCsiNodeList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCsiNodeList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCsiNodeList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCsiNodeList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCsiNodeList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCsiNodeList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCsiNodeList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCsiNodeList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCsiNodeList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCsiNodeList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeListProps.go new file mode 100644 index 0000000..587882d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// CSINodeList is a collection of CSINode objects. +type KubeCsiNodeListProps struct { + // items is the list of CSINode. + Items *[]*KubeCsiNodeProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeList__checks.go new file mode 100644 index 0000000..f2f200b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCsiNodeList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiNodeList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiNodeList_ManifestParameters(props *KubeCsiNodeListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCsiNodeList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCsiNodeListParameters(scope constructs.Construct, id *string, props *KubeCsiNodeListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeList__no_checks.go new file mode 100644 index 0000000..3b1654b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCsiNodeList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCsiNodeList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCsiNodeList_ManifestParameters(props *KubeCsiNodeListProps) error { + return nil +} + +func validateKubeCsiNodeList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCsiNodeListParameters(scope constructs.Construct, id *string, props *KubeCsiNodeListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeProps.go new file mode 100644 index 0000000..a37d7aa --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNodeProps.go @@ -0,0 +1,13 @@ +package k8s + + +// CSINode holds information about all CSI drivers installed on a node. +// +// CSI drivers do not need to create the CSINode object directly. As long as they use the node-driver-registrar sidecar container, the kubelet will automatically populate the CSINode object for the CSI driver as part of kubelet plugin registration. CSINode has the same name as a node. If the object is missing, it means either there are no CSI Drivers available on the node, or the Kubelet version is low enough that it doesn't create this object. CSINode has an OwnerReference that points to the corresponding node object. +type KubeCsiNodeProps struct { + // spec is the specification of CSINode. + Spec *CsiNodeSpec `field:"required" json:"spec" yaml:"spec"` + // metadata.name must be the Kubernetes node name. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNode__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNode__checks.go new file mode 100644 index 0000000..a0fcea3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNode__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCsiNode_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiNode_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiNode_ManifestParameters(props *KubeCsiNodeProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCsiNode_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCsiNodeParameters(scope constructs.Construct, id *string, props *KubeCsiNodeProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNode__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNode__no_checks.go new file mode 100644 index 0000000..b00b7f3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiNode__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCsiNode_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCsiNode_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCsiNode_ManifestParameters(props *KubeCsiNodeProps) error { + return nil +} + +func validateKubeCsiNode_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCsiNodeParameters(scope constructs.Construct, id *string, props *KubeCsiNodeProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacity.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacity.go new file mode 100644 index 0000000..597a434 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacity.go @@ -0,0 +1,327 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CSIStorageCapacity stores the result of one CSI GetCapacity call. +// +// For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes. +// +// For example this can express things like: - StorageClass "standard" has "1234 GiB" available in "topology.kubernetes.io/zone=us-east1" - StorageClass "localssd" has "10 GiB" available in "kubernetes.io/hostname=knode-abc123" +// +// The following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zero +// +// The producer of these objects can decide which approach is more suitable. +// +// They are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node. +type KubeCsiStorageCapacity interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCsiStorageCapacity +type jsiiProxy_KubeCsiStorageCapacity struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCsiStorageCapacity) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacity) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacity) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacity) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacity) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacity) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacity) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1.CSIStorageCapacity" API object. +func NewKubeCsiStorageCapacity(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityProps) KubeCsiStorageCapacity { + _init_.Initialize() + + if err := validateNewKubeCsiStorageCapacityParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCsiStorageCapacity{} + + _jsii_.Create( + "k8s.KubeCsiStorageCapacity", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1.CSIStorageCapacity" API object. +func NewKubeCsiStorageCapacity_Override(k KubeCsiStorageCapacity, scope constructs.Construct, id *string, props *KubeCsiStorageCapacityProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCsiStorageCapacity", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCsiStorageCapacity_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacity_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacity", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCsiStorageCapacity_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacity_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacity", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1.CSIStorageCapacity". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCsiStorageCapacity_Manifest(props *KubeCsiStorageCapacityProps) interface{} { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacity_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacity", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCsiStorageCapacity_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacity_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacity", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCsiStorageCapacity_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCsiStorageCapacity", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCsiStorageCapacity) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCsiStorageCapacity) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCsiStorageCapacity) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCsiStorageCapacity) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityList.go new file mode 100644 index 0000000..171a995 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CSIStorageCapacityList is a collection of CSIStorageCapacity objects. +type KubeCsiStorageCapacityList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCsiStorageCapacityList +type jsiiProxy_KubeCsiStorageCapacityList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCsiStorageCapacityList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1.CSIStorageCapacityList" API object. +func NewKubeCsiStorageCapacityList(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityListProps) KubeCsiStorageCapacityList { + _init_.Initialize() + + if err := validateNewKubeCsiStorageCapacityListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCsiStorageCapacityList{} + + _jsii_.Create( + "k8s.KubeCsiStorageCapacityList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1.CSIStorageCapacityList" API object. +func NewKubeCsiStorageCapacityList_Override(k KubeCsiStorageCapacityList, scope constructs.Construct, id *string, props *KubeCsiStorageCapacityListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCsiStorageCapacityList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCsiStorageCapacityList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCsiStorageCapacityList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1.CSIStorageCapacityList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCsiStorageCapacityList_Manifest(props *KubeCsiStorageCapacityListProps) interface{} { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCsiStorageCapacityList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCsiStorageCapacityList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCsiStorageCapacityList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCsiStorageCapacityList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCsiStorageCapacityList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCsiStorageCapacityList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCsiStorageCapacityList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListProps.go new file mode 100644 index 0000000..1acc63d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// CSIStorageCapacityList is a collection of CSIStorageCapacity objects. +type KubeCsiStorageCapacityListProps struct { + // Items is the list of CSIStorageCapacity objects. + Items *[]*KubeCsiStorageCapacityProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1.go new file mode 100644 index 0000000..8c9866f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CSIStorageCapacityList is a collection of CSIStorageCapacity objects. +type KubeCsiStorageCapacityListV1Beta1 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCsiStorageCapacityListV1Beta1 +type jsiiProxy_KubeCsiStorageCapacityListV1Beta1 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1beta1.CSIStorageCapacityList" API object. +func NewKubeCsiStorageCapacityListV1Beta1(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityListV1Beta1Props) KubeCsiStorageCapacityListV1Beta1 { + _init_.Initialize() + + if err := validateNewKubeCsiStorageCapacityListV1Beta1Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCsiStorageCapacityListV1Beta1{} + + _jsii_.Create( + "k8s.KubeCsiStorageCapacityListV1Beta1", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1beta1.CSIStorageCapacityList" API object. +func NewKubeCsiStorageCapacityListV1Beta1_Override(k KubeCsiStorageCapacityListV1Beta1, scope constructs.Construct, id *string, props *KubeCsiStorageCapacityListV1Beta1Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCsiStorageCapacityListV1Beta1", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCsiStorageCapacityListV1Beta1_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityListV1Beta1_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityListV1Beta1", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCsiStorageCapacityListV1Beta1_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityListV1Beta1_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityListV1Beta1", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1beta1.CSIStorageCapacityList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCsiStorageCapacityListV1Beta1_Manifest(props *KubeCsiStorageCapacityListV1Beta1Props) interface{} { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityListV1Beta1_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityListV1Beta1", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCsiStorageCapacityListV1Beta1_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityListV1Beta1_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityListV1Beta1", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCsiStorageCapacityListV1Beta1_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCsiStorageCapacityListV1Beta1", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCsiStorageCapacityListV1Beta1) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1Props.go new file mode 100644 index 0000000..450b4b6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1Props.go @@ -0,0 +1,11 @@ +package k8s + + +// CSIStorageCapacityList is a collection of CSIStorageCapacity objects. +type KubeCsiStorageCapacityListV1Beta1Props struct { + // Items is the list of CSIStorageCapacity objects. + Items *[]*KubeCsiStorageCapacityV1Beta1Props `field:"required" json:"items" yaml:"items"` + // Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1__checks.go new file mode 100644 index 0000000..64d9e19 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCsiStorageCapacityListV1Beta1_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiStorageCapacityListV1Beta1_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiStorageCapacityListV1Beta1_ManifestParameters(props *KubeCsiStorageCapacityListV1Beta1Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCsiStorageCapacityListV1Beta1_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCsiStorageCapacityListV1Beta1Parameters(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityListV1Beta1Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1__no_checks.go new file mode 100644 index 0000000..a8712df --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityListV1Beta1__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCsiStorageCapacityListV1Beta1_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCsiStorageCapacityListV1Beta1_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCsiStorageCapacityListV1Beta1_ManifestParameters(props *KubeCsiStorageCapacityListV1Beta1Props) error { + return nil +} + +func validateKubeCsiStorageCapacityListV1Beta1_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCsiStorageCapacityListV1Beta1Parameters(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityListV1Beta1Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityList__checks.go new file mode 100644 index 0000000..69119b7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCsiStorageCapacityList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiStorageCapacityList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiStorageCapacityList_ManifestParameters(props *KubeCsiStorageCapacityListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCsiStorageCapacityList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCsiStorageCapacityListParameters(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityList__no_checks.go new file mode 100644 index 0000000..3404d4a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCsiStorageCapacityList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCsiStorageCapacityList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCsiStorageCapacityList_ManifestParameters(props *KubeCsiStorageCapacityListProps) error { + return nil +} + +func validateKubeCsiStorageCapacityList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCsiStorageCapacityListParameters(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityProps.go new file mode 100644 index 0000000..37cfd1f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityProps.go @@ -0,0 +1,41 @@ +package k8s + + +// CSIStorageCapacity stores the result of one CSI GetCapacity call. +// +// For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes. +// +// For example this can express things like: - StorageClass "standard" has "1234 GiB" available in "topology.kubernetes.io/zone=us-east1" - StorageClass "localssd" has "10 GiB" available in "kubernetes.io/hostname=knode-abc123" +// +// The following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zero +// +// The producer of these objects can decide which approach is more suitable. +// +// They are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node. +type KubeCsiStorageCapacityProps struct { + // The name of the StorageClass that the reported capacity applies to. + // + // It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable. + StorageClassName *string `field:"required" json:"storageClassName" yaml:"storageClassName"` + // Capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. + // + // The semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable. + Capacity Quantity `field:"optional" json:"capacity" yaml:"capacity"` + // MaximumVolumeSize is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. + // + // This is defined since CSI spec 1.4.0 as the largest size that may be used in a CreateVolumeRequest.capacity_range.required_bytes field to create a volume with the same parameters as those in GetCapacityRequest. The corresponding value in the Kubernetes API is ResourceRequirements.Requests in a volume claim. + MaximumVolumeSize Quantity `field:"optional" json:"maximumVolumeSize" yaml:"maximumVolumeSize"` + // Standard object's metadata. + // + // The name has no particular meaning. It must be be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-, a generated name, or a reverse-domain name which ends with the unique CSI driver name. + // + // Objects are namespaced. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // NodeTopology defines which nodes have access to the storage for which capacity was reported. + // + // If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable. + NodeTopology *LabelSelector `field:"optional" json:"nodeTopology" yaml:"nodeTopology"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1.go new file mode 100644 index 0000000..bf08894 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1.go @@ -0,0 +1,327 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CSIStorageCapacity stores the result of one CSI GetCapacity call. +// +// For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes. +// +// For example this can express things like: - StorageClass "standard" has "1234 GiB" available in "topology.kubernetes.io/zone=us-east1" - StorageClass "localssd" has "10 GiB" available in "kubernetes.io/hostname=knode-abc123" +// +// The following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zero +// +// The producer of these objects can decide which approach is more suitable. +// +// They are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node. +type KubeCsiStorageCapacityV1Beta1 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCsiStorageCapacityV1Beta1 +type jsiiProxy_KubeCsiStorageCapacityV1Beta1 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCsiStorageCapacityV1Beta1) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityV1Beta1) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityV1Beta1) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityV1Beta1) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityV1Beta1) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityV1Beta1) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCsiStorageCapacityV1Beta1) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1beta1.CSIStorageCapacity" API object. +func NewKubeCsiStorageCapacityV1Beta1(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityV1Beta1Props) KubeCsiStorageCapacityV1Beta1 { + _init_.Initialize() + + if err := validateNewKubeCsiStorageCapacityV1Beta1Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCsiStorageCapacityV1Beta1{} + + _jsii_.Create( + "k8s.KubeCsiStorageCapacityV1Beta1", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1beta1.CSIStorageCapacity" API object. +func NewKubeCsiStorageCapacityV1Beta1_Override(k KubeCsiStorageCapacityV1Beta1, scope constructs.Construct, id *string, props *KubeCsiStorageCapacityV1Beta1Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCsiStorageCapacityV1Beta1", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCsiStorageCapacityV1Beta1_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityV1Beta1_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityV1Beta1", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCsiStorageCapacityV1Beta1_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityV1Beta1_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityV1Beta1", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1beta1.CSIStorageCapacity". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCsiStorageCapacityV1Beta1_Manifest(props *KubeCsiStorageCapacityV1Beta1Props) interface{} { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityV1Beta1_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityV1Beta1", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCsiStorageCapacityV1Beta1_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCsiStorageCapacityV1Beta1_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCsiStorageCapacityV1Beta1", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCsiStorageCapacityV1Beta1_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCsiStorageCapacityV1Beta1", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCsiStorageCapacityV1Beta1) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCsiStorageCapacityV1Beta1) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCsiStorageCapacityV1Beta1) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCsiStorageCapacityV1Beta1) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1Props.go new file mode 100644 index 0000000..8fe2fd4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1Props.go @@ -0,0 +1,41 @@ +package k8s + + +// CSIStorageCapacity stores the result of one CSI GetCapacity call. +// +// For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes. +// +// For example this can express things like: - StorageClass "standard" has "1234 GiB" available in "topology.kubernetes.io/zone=us-east1" - StorageClass "localssd" has "10 GiB" available in "kubernetes.io/hostname=knode-abc123" +// +// The following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zero +// +// The producer of these objects can decide which approach is more suitable. +// +// They are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node. +type KubeCsiStorageCapacityV1Beta1Props struct { + // The name of the StorageClass that the reported capacity applies to. + // + // It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable. + StorageClassName *string `field:"required" json:"storageClassName" yaml:"storageClassName"` + // Capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. + // + // The semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable. + Capacity Quantity `field:"optional" json:"capacity" yaml:"capacity"` + // MaximumVolumeSize is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. + // + // This is defined since CSI spec 1.4.0 as the largest size that may be used in a CreateVolumeRequest.capacity_range.required_bytes field to create a volume with the same parameters as those in GetCapacityRequest. The corresponding value in the Kubernetes API is ResourceRequirements.Requests in a volume claim. + MaximumVolumeSize Quantity `field:"optional" json:"maximumVolumeSize" yaml:"maximumVolumeSize"` + // Standard object's metadata. + // + // The name has no particular meaning. It must be be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-, a generated name, or a reverse-domain name which ends with the unique CSI driver name. + // + // Objects are namespaced. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // NodeTopology defines which nodes have access to the storage for which capacity was reported. + // + // If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable. + NodeTopology *LabelSelector `field:"optional" json:"nodeTopology" yaml:"nodeTopology"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1__checks.go new file mode 100644 index 0000000..259555b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCsiStorageCapacityV1Beta1_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiStorageCapacityV1Beta1_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiStorageCapacityV1Beta1_ManifestParameters(props *KubeCsiStorageCapacityV1Beta1Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCsiStorageCapacityV1Beta1_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCsiStorageCapacityV1Beta1Parameters(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityV1Beta1Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1__no_checks.go new file mode 100644 index 0000000..eba8f6b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacityV1Beta1__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCsiStorageCapacityV1Beta1_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCsiStorageCapacityV1Beta1_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCsiStorageCapacityV1Beta1_ManifestParameters(props *KubeCsiStorageCapacityV1Beta1Props) error { + return nil +} + +func validateKubeCsiStorageCapacityV1Beta1_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCsiStorageCapacityV1Beta1Parameters(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityV1Beta1Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacity__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacity__checks.go new file mode 100644 index 0000000..3996893 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacity__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCsiStorageCapacity_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiStorageCapacity_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCsiStorageCapacity_ManifestParameters(props *KubeCsiStorageCapacityProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCsiStorageCapacity_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCsiStorageCapacityParameters(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacity__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacity__no_checks.go new file mode 100644 index 0000000..01f7971 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCsiStorageCapacity__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCsiStorageCapacity_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCsiStorageCapacity_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCsiStorageCapacity_ManifestParameters(props *KubeCsiStorageCapacityProps) error { + return nil +} + +func validateKubeCsiStorageCapacity_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCsiStorageCapacityParameters(scope constructs.Construct, id *string, props *KubeCsiStorageCapacityProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinition.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinition.go new file mode 100644 index 0000000..813384c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinition.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CustomResourceDefinition represents a resource that should be exposed on the API server. +// +// Its name MUST be in the format <.spec.name>.<.spec.group>. +type KubeCustomResourceDefinition interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCustomResourceDefinition +type jsiiProxy_KubeCustomResourceDefinition struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCustomResourceDefinition) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinition) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinition) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinition) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinition) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinition) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinition) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinition" API object. +func NewKubeCustomResourceDefinition(scope constructs.Construct, id *string, props *KubeCustomResourceDefinitionProps) KubeCustomResourceDefinition { + _init_.Initialize() + + if err := validateNewKubeCustomResourceDefinitionParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCustomResourceDefinition{} + + _jsii_.Create( + "k8s.KubeCustomResourceDefinition", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinition" API object. +func NewKubeCustomResourceDefinition_Override(k KubeCustomResourceDefinition, scope constructs.Construct, id *string, props *KubeCustomResourceDefinitionProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCustomResourceDefinition", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCustomResourceDefinition_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCustomResourceDefinition_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCustomResourceDefinition", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCustomResourceDefinition_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCustomResourceDefinition_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCustomResourceDefinition", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinition". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCustomResourceDefinition_Manifest(props *KubeCustomResourceDefinitionProps) interface{} { + _init_.Initialize() + + if err := validateKubeCustomResourceDefinition_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCustomResourceDefinition", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCustomResourceDefinition_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCustomResourceDefinition_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCustomResourceDefinition", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCustomResourceDefinition_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCustomResourceDefinition", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCustomResourceDefinition) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCustomResourceDefinition) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCustomResourceDefinition) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCustomResourceDefinition) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionList.go new file mode 100644 index 0000000..7d79d45 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// CustomResourceDefinitionList is a list of CustomResourceDefinition objects. +type KubeCustomResourceDefinitionList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeCustomResourceDefinitionList +type jsiiProxy_KubeCustomResourceDefinitionList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeCustomResourceDefinitionList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinitionList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinitionList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinitionList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinitionList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinitionList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeCustomResourceDefinitionList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionList" API object. +func NewKubeCustomResourceDefinitionList(scope constructs.Construct, id *string, props *KubeCustomResourceDefinitionListProps) KubeCustomResourceDefinitionList { + _init_.Initialize() + + if err := validateNewKubeCustomResourceDefinitionListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeCustomResourceDefinitionList{} + + _jsii_.Create( + "k8s.KubeCustomResourceDefinitionList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionList" API object. +func NewKubeCustomResourceDefinitionList_Override(k KubeCustomResourceDefinitionList, scope constructs.Construct, id *string, props *KubeCustomResourceDefinitionListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeCustomResourceDefinitionList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeCustomResourceDefinitionList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCustomResourceDefinitionList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCustomResourceDefinitionList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeCustomResourceDefinitionList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeCustomResourceDefinitionList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeCustomResourceDefinitionList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeCustomResourceDefinitionList_Manifest(props *KubeCustomResourceDefinitionListProps) interface{} { + _init_.Initialize() + + if err := validateKubeCustomResourceDefinitionList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeCustomResourceDefinitionList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeCustomResourceDefinitionList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeCustomResourceDefinitionList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeCustomResourceDefinitionList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeCustomResourceDefinitionList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeCustomResourceDefinitionList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeCustomResourceDefinitionList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeCustomResourceDefinitionList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeCustomResourceDefinitionList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeCustomResourceDefinitionList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionListProps.go new file mode 100644 index 0000000..b27c190 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// CustomResourceDefinitionList is a list of CustomResourceDefinition objects. +type KubeCustomResourceDefinitionListProps struct { + // items list individual CustomResourceDefinition objects. + Items *[]*KubeCustomResourceDefinitionProps `field:"required" json:"items" yaml:"items"` + // Standard object's metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionList__checks.go new file mode 100644 index 0000000..d219f71 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCustomResourceDefinitionList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCustomResourceDefinitionList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCustomResourceDefinitionList_ManifestParameters(props *KubeCustomResourceDefinitionListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCustomResourceDefinitionList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCustomResourceDefinitionListParameters(scope constructs.Construct, id *string, props *KubeCustomResourceDefinitionListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionList__no_checks.go new file mode 100644 index 0000000..8accd24 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCustomResourceDefinitionList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCustomResourceDefinitionList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCustomResourceDefinitionList_ManifestParameters(props *KubeCustomResourceDefinitionListProps) error { + return nil +} + +func validateKubeCustomResourceDefinitionList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCustomResourceDefinitionListParameters(scope constructs.Construct, id *string, props *KubeCustomResourceDefinitionListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionProps.go new file mode 100644 index 0000000..fd8d00b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinitionProps.go @@ -0,0 +1,13 @@ +package k8s + + +// CustomResourceDefinition represents a resource that should be exposed on the API server. +// +// Its name MUST be in the format <.spec.name>.<.spec.group>. +type KubeCustomResourceDefinitionProps struct { + // spec describes how the user wants the resources to appear. + Spec *CustomResourceDefinitionSpec `field:"required" json:"spec" yaml:"spec"` + // Standard object's metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinition__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinition__checks.go new file mode 100644 index 0000000..e9b3548 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinition__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeCustomResourceDefinition_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeCustomResourceDefinition_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeCustomResourceDefinition_ManifestParameters(props *KubeCustomResourceDefinitionProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeCustomResourceDefinition_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeCustomResourceDefinitionParameters(scope constructs.Construct, id *string, props *KubeCustomResourceDefinitionProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinition__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinition__no_checks.go new file mode 100644 index 0000000..fe47411 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeCustomResourceDefinition__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeCustomResourceDefinition_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeCustomResourceDefinition_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeCustomResourceDefinition_ManifestParameters(props *KubeCustomResourceDefinitionProps) error { + return nil +} + +func validateKubeCustomResourceDefinition_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeCustomResourceDefinitionParameters(scope constructs.Construct, id *string, props *KubeCustomResourceDefinitionProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSet.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSet.go new file mode 100644 index 0000000..9e3f157 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSet.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// DaemonSet represents the configuration of a daemon set. +type KubeDaemonSet interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeDaemonSet +type jsiiProxy_KubeDaemonSet struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeDaemonSet) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSet) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSet) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSet) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSet) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSet) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSet) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apps.v1.DaemonSet" API object. +func NewKubeDaemonSet(scope constructs.Construct, id *string, props *KubeDaemonSetProps) KubeDaemonSet { + _init_.Initialize() + + if err := validateNewKubeDaemonSetParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeDaemonSet{} + + _jsii_.Create( + "k8s.KubeDaemonSet", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apps.v1.DaemonSet" API object. +func NewKubeDaemonSet_Override(k KubeDaemonSet, scope constructs.Construct, id *string, props *KubeDaemonSetProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeDaemonSet", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeDaemonSet_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeDaemonSet_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeDaemonSet", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeDaemonSet_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeDaemonSet_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeDaemonSet", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apps.v1.DaemonSet". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeDaemonSet_Manifest(props *KubeDaemonSetProps) interface{} { + _init_.Initialize() + + if err := validateKubeDaemonSet_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeDaemonSet", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeDaemonSet_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeDaemonSet_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeDaemonSet", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeDaemonSet_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeDaemonSet", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeDaemonSet) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeDaemonSet) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeDaemonSet) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeDaemonSet) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetList.go new file mode 100644 index 0000000..99eebc7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// DaemonSetList is a collection of daemon sets. +type KubeDaemonSetList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeDaemonSetList +type jsiiProxy_KubeDaemonSetList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeDaemonSetList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSetList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSetList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSetList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSetList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSetList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDaemonSetList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apps.v1.DaemonSetList" API object. +func NewKubeDaemonSetList(scope constructs.Construct, id *string, props *KubeDaemonSetListProps) KubeDaemonSetList { + _init_.Initialize() + + if err := validateNewKubeDaemonSetListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeDaemonSetList{} + + _jsii_.Create( + "k8s.KubeDaemonSetList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apps.v1.DaemonSetList" API object. +func NewKubeDaemonSetList_Override(k KubeDaemonSetList, scope constructs.Construct, id *string, props *KubeDaemonSetListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeDaemonSetList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeDaemonSetList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeDaemonSetList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeDaemonSetList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeDaemonSetList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeDaemonSetList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeDaemonSetList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apps.v1.DaemonSetList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeDaemonSetList_Manifest(props *KubeDaemonSetListProps) interface{} { + _init_.Initialize() + + if err := validateKubeDaemonSetList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeDaemonSetList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeDaemonSetList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeDaemonSetList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeDaemonSetList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeDaemonSetList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeDaemonSetList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeDaemonSetList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeDaemonSetList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeDaemonSetList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeDaemonSetList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetListProps.go new file mode 100644 index 0000000..83dded4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// DaemonSetList is a collection of daemon sets. +type KubeDaemonSetListProps struct { + // A list of daemon sets. + Items *[]*KubeDaemonSetProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetList__checks.go new file mode 100644 index 0000000..351f5f4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeDaemonSetList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeDaemonSetList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeDaemonSetList_ManifestParameters(props *KubeDaemonSetListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeDaemonSetList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeDaemonSetListParameters(scope constructs.Construct, id *string, props *KubeDaemonSetListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetList__no_checks.go new file mode 100644 index 0000000..a647744 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeDaemonSetList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeDaemonSetList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeDaemonSetList_ManifestParameters(props *KubeDaemonSetListProps) error { + return nil +} + +func validateKubeDaemonSetList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeDaemonSetListParameters(scope constructs.Construct, id *string, props *KubeDaemonSetListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetProps.go new file mode 100644 index 0000000..28b38c6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSetProps.go @@ -0,0 +1,15 @@ +package k8s + + +// DaemonSet represents the configuration of a daemon set. +type KubeDaemonSetProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // The desired behavior of this daemon set. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *DaemonSetSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSet__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSet__checks.go new file mode 100644 index 0000000..11c6841 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSet__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeDaemonSet_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeDaemonSet_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeDaemonSet_ManifestParameters(props *KubeDaemonSetProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeDaemonSet_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeDaemonSetParameters(scope constructs.Construct, id *string, props *KubeDaemonSetProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSet__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSet__no_checks.go new file mode 100644 index 0000000..f2f3c21 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDaemonSet__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeDaemonSet_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeDaemonSet_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeDaemonSet_ManifestParameters(props *KubeDaemonSetProps) error { + return nil +} + +func validateKubeDaemonSet_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeDaemonSetParameters(scope constructs.Construct, id *string, props *KubeDaemonSetProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDeployment.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeployment.go new file mode 100644 index 0000000..f8d2407 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeployment.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Deployment enables declarative updates for Pods and ReplicaSets. +type KubeDeployment interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeDeployment +type jsiiProxy_KubeDeployment struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeDeployment) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeployment) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeployment) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeployment) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeployment) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeployment) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeployment) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apps.v1.Deployment" API object. +func NewKubeDeployment(scope constructs.Construct, id *string, props *KubeDeploymentProps) KubeDeployment { + _init_.Initialize() + + if err := validateNewKubeDeploymentParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeDeployment{} + + _jsii_.Create( + "k8s.KubeDeployment", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apps.v1.Deployment" API object. +func NewKubeDeployment_Override(k KubeDeployment, scope constructs.Construct, id *string, props *KubeDeploymentProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeDeployment", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeDeployment_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeDeployment_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeDeployment", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeDeployment_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeDeployment_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeDeployment", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apps.v1.Deployment". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeDeployment_Manifest(props *KubeDeploymentProps) interface{} { + _init_.Initialize() + + if err := validateKubeDeployment_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeDeployment", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeDeployment_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeDeployment_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeDeployment", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeDeployment_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeDeployment", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeDeployment) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeDeployment) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeDeployment) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeDeployment) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentList.go new file mode 100644 index 0000000..3b0160b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// DeploymentList is a list of Deployments. +type KubeDeploymentList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeDeploymentList +type jsiiProxy_KubeDeploymentList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeDeploymentList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeploymentList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeploymentList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeploymentList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeploymentList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeploymentList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeDeploymentList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apps.v1.DeploymentList" API object. +func NewKubeDeploymentList(scope constructs.Construct, id *string, props *KubeDeploymentListProps) KubeDeploymentList { + _init_.Initialize() + + if err := validateNewKubeDeploymentListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeDeploymentList{} + + _jsii_.Create( + "k8s.KubeDeploymentList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apps.v1.DeploymentList" API object. +func NewKubeDeploymentList_Override(k KubeDeploymentList, scope constructs.Construct, id *string, props *KubeDeploymentListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeDeploymentList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeDeploymentList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeDeploymentList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeDeploymentList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeDeploymentList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeDeploymentList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeDeploymentList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apps.v1.DeploymentList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeDeploymentList_Manifest(props *KubeDeploymentListProps) interface{} { + _init_.Initialize() + + if err := validateKubeDeploymentList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeDeploymentList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeDeploymentList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeDeploymentList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeDeploymentList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeDeploymentList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeDeploymentList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeDeploymentList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeDeploymentList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeDeploymentList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeDeploymentList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentListProps.go new file mode 100644 index 0000000..775f02a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// DeploymentList is a list of Deployments. +type KubeDeploymentListProps struct { + // Items is the list of Deployments. + Items *[]*KubeDeploymentProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentList__checks.go new file mode 100644 index 0000000..628fd6f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeDeploymentList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeDeploymentList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeDeploymentList_ManifestParameters(props *KubeDeploymentListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeDeploymentList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeDeploymentListParameters(scope constructs.Construct, id *string, props *KubeDeploymentListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentList__no_checks.go new file mode 100644 index 0000000..076ae2e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeDeploymentList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeDeploymentList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeDeploymentList_ManifestParameters(props *KubeDeploymentListProps) error { + return nil +} + +func validateKubeDeploymentList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeDeploymentListParameters(scope constructs.Construct, id *string, props *KubeDeploymentListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentProps.go new file mode 100644 index 0000000..0bae948 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeploymentProps.go @@ -0,0 +1,13 @@ +package k8s + + +// Deployment enables declarative updates for Pods and ReplicaSets. +type KubeDeploymentProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Specification of the desired behavior of the Deployment. + Spec *DeploymentSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDeployment__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeployment__checks.go new file mode 100644 index 0000000..333a0ea --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeployment__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeDeployment_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeDeployment_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeDeployment_ManifestParameters(props *KubeDeploymentProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeDeployment_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeDeploymentParameters(scope constructs.Construct, id *string, props *KubeDeploymentProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeDeployment__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeployment__no_checks.go new file mode 100644 index 0000000..6d0946c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeDeployment__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeDeployment_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeDeployment_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeDeployment_ManifestParameters(props *KubeDeploymentProps) error { + return nil +} + +func validateKubeDeployment_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeDeploymentParameters(scope constructs.Construct, id *string, props *KubeDeploymentProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSlice.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSlice.go new file mode 100644 index 0000000..8270beb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSlice.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// EndpointSlice represents a subset of the endpoints that implement a service. +// +// For a given service there may be multiple EndpointSlice objects, selected by labels, which must be joined to produce the full set of endpoints. +type KubeEndpointSlice interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeEndpointSlice +type jsiiProxy_KubeEndpointSlice struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeEndpointSlice) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSlice) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSlice) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSlice) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSlice) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSlice) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSlice) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.discovery.v1.EndpointSlice" API object. +func NewKubeEndpointSlice(scope constructs.Construct, id *string, props *KubeEndpointSliceProps) KubeEndpointSlice { + _init_.Initialize() + + if err := validateNewKubeEndpointSliceParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeEndpointSlice{} + + _jsii_.Create( + "k8s.KubeEndpointSlice", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.discovery.v1.EndpointSlice" API object. +func NewKubeEndpointSlice_Override(k KubeEndpointSlice, scope constructs.Construct, id *string, props *KubeEndpointSliceProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeEndpointSlice", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeEndpointSlice_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEndpointSlice_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEndpointSlice", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeEndpointSlice_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEndpointSlice_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEndpointSlice", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.discovery.v1.EndpointSlice". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeEndpointSlice_Manifest(props *KubeEndpointSliceProps) interface{} { + _init_.Initialize() + + if err := validateKubeEndpointSlice_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeEndpointSlice", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeEndpointSlice_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeEndpointSlice_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeEndpointSlice", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeEndpointSlice_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeEndpointSlice", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeEndpointSlice) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeEndpointSlice) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeEndpointSlice) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeEndpointSlice) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceList.go new file mode 100644 index 0000000..647754f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// EndpointSliceList represents a list of endpoint slices. +type KubeEndpointSliceList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeEndpointSliceList +type jsiiProxy_KubeEndpointSliceList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeEndpointSliceList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSliceList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSliceList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSliceList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSliceList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSliceList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointSliceList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.discovery.v1.EndpointSliceList" API object. +func NewKubeEndpointSliceList(scope constructs.Construct, id *string, props *KubeEndpointSliceListProps) KubeEndpointSliceList { + _init_.Initialize() + + if err := validateNewKubeEndpointSliceListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeEndpointSliceList{} + + _jsii_.Create( + "k8s.KubeEndpointSliceList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.discovery.v1.EndpointSliceList" API object. +func NewKubeEndpointSliceList_Override(k KubeEndpointSliceList, scope constructs.Construct, id *string, props *KubeEndpointSliceListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeEndpointSliceList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeEndpointSliceList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEndpointSliceList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEndpointSliceList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeEndpointSliceList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEndpointSliceList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEndpointSliceList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.discovery.v1.EndpointSliceList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeEndpointSliceList_Manifest(props *KubeEndpointSliceListProps) interface{} { + _init_.Initialize() + + if err := validateKubeEndpointSliceList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeEndpointSliceList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeEndpointSliceList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeEndpointSliceList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeEndpointSliceList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeEndpointSliceList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeEndpointSliceList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeEndpointSliceList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeEndpointSliceList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeEndpointSliceList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeEndpointSliceList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceListProps.go new file mode 100644 index 0000000..bddd417 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// EndpointSliceList represents a list of endpoint slices. +type KubeEndpointSliceListProps struct { + // List of endpoint slices. + Items *[]*KubeEndpointSliceProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceList__checks.go new file mode 100644 index 0000000..8b53ac4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeEndpointSliceList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeEndpointSliceList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeEndpointSliceList_ManifestParameters(props *KubeEndpointSliceListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeEndpointSliceList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeEndpointSliceListParameters(scope constructs.Construct, id *string, props *KubeEndpointSliceListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceList__no_checks.go new file mode 100644 index 0000000..d5e0209 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeEndpointSliceList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeEndpointSliceList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeEndpointSliceList_ManifestParameters(props *KubeEndpointSliceListProps) error { + return nil +} + +func validateKubeEndpointSliceList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeEndpointSliceListParameters(scope constructs.Construct, id *string, props *KubeEndpointSliceListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceProps.go new file mode 100644 index 0000000..cf6b38e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSliceProps.go @@ -0,0 +1,23 @@ +package k8s + + +// EndpointSlice represents a subset of the endpoints that implement a service. +// +// For a given service there may be multiple EndpointSlice objects, selected by labels, which must be joined to produce the full set of endpoints. +type KubeEndpointSliceProps struct { + // addressType specifies the type of address carried by this EndpointSlice. + // + // All addresses in this slice must be the same type. This field is immutable after creation. The following address types are currently supported: * IPv4: Represents an IPv4 Address. * IPv6: Represents an IPv6 Address. * FQDN: Represents a Fully Qualified Domain Name. + AddressType *string `field:"required" json:"addressType" yaml:"addressType"` + // endpoints is a list of unique endpoints in this slice. + // + // Each slice may include a maximum of 1000 endpoints. + Endpoints *[]*Endpoint `field:"required" json:"endpoints" yaml:"endpoints"` + // Standard object's metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // ports specifies the list of network ports exposed by each endpoint in this slice. + // + // Each port must have a unique name. When ports is empty, it indicates that there are no defined ports. When a port is defined with a nil port value, it indicates "all ports". Each slice may include a maximum of 100 ports. + Ports *[]*EndpointPort `field:"optional" json:"ports" yaml:"ports"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSlice__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSlice__checks.go new file mode 100644 index 0000000..49bd561 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSlice__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeEndpointSlice_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeEndpointSlice_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeEndpointSlice_ManifestParameters(props *KubeEndpointSliceProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeEndpointSlice_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeEndpointSliceParameters(scope constructs.Construct, id *string, props *KubeEndpointSliceProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSlice__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSlice__no_checks.go new file mode 100644 index 0000000..e7f9db2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointSlice__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeEndpointSlice_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeEndpointSlice_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeEndpointSlice_ManifestParameters(props *KubeEndpointSliceProps) error { + return nil +} + +func validateKubeEndpointSlice_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeEndpointSliceParameters(scope constructs.Construct, id *string, props *KubeEndpointSliceProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpoints.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpoints.go new file mode 100644 index 0000000..a14466f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpoints.go @@ -0,0 +1,329 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Endpoints is a collection of endpoints that implement the actual service. Example:. +// +// Name: "mysvc", +// Subsets: [ +// { +// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], +// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] +// }, +// { +// Addresses: [{"ip": "10.10.3.3"}], +// Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}] +// }, +// ]. +type KubeEndpoints interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeEndpoints +type jsiiProxy_KubeEndpoints struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeEndpoints) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpoints) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpoints) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpoints) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpoints) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpoints) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpoints) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.Endpoints" API object. +func NewKubeEndpoints(scope constructs.Construct, id *string, props *KubeEndpointsProps) KubeEndpoints { + _init_.Initialize() + + if err := validateNewKubeEndpointsParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeEndpoints{} + + _jsii_.Create( + "k8s.KubeEndpoints", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.Endpoints" API object. +func NewKubeEndpoints_Override(k KubeEndpoints, scope constructs.Construct, id *string, props *KubeEndpointsProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeEndpoints", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeEndpoints_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEndpoints_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEndpoints", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeEndpoints_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEndpoints_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEndpoints", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.Endpoints". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeEndpoints_Manifest(props *KubeEndpointsProps) interface{} { + _init_.Initialize() + + if err := validateKubeEndpoints_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeEndpoints", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeEndpoints_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeEndpoints_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeEndpoints", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeEndpoints_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeEndpoints", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeEndpoints) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeEndpoints) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeEndpoints) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeEndpoints) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsList.go new file mode 100644 index 0000000..007c0d2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// EndpointsList is a list of endpoints. +type KubeEndpointsList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeEndpointsList +type jsiiProxy_KubeEndpointsList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeEndpointsList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointsList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointsList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointsList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointsList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointsList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEndpointsList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.EndpointsList" API object. +func NewKubeEndpointsList(scope constructs.Construct, id *string, props *KubeEndpointsListProps) KubeEndpointsList { + _init_.Initialize() + + if err := validateNewKubeEndpointsListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeEndpointsList{} + + _jsii_.Create( + "k8s.KubeEndpointsList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.EndpointsList" API object. +func NewKubeEndpointsList_Override(k KubeEndpointsList, scope constructs.Construct, id *string, props *KubeEndpointsListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeEndpointsList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeEndpointsList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEndpointsList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEndpointsList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeEndpointsList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEndpointsList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEndpointsList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.EndpointsList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeEndpointsList_Manifest(props *KubeEndpointsListProps) interface{} { + _init_.Initialize() + + if err := validateKubeEndpointsList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeEndpointsList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeEndpointsList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeEndpointsList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeEndpointsList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeEndpointsList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeEndpointsList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeEndpointsList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeEndpointsList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeEndpointsList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeEndpointsList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsListProps.go new file mode 100644 index 0000000..97543f0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// EndpointsList is a list of endpoints. +type KubeEndpointsListProps struct { + // List of endpoints. + Items *[]*KubeEndpointsProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsList__checks.go new file mode 100644 index 0000000..36d3b42 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeEndpointsList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeEndpointsList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeEndpointsList_ManifestParameters(props *KubeEndpointsListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeEndpointsList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeEndpointsListParameters(scope constructs.Construct, id *string, props *KubeEndpointsListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsList__no_checks.go new file mode 100644 index 0000000..2356101 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeEndpointsList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeEndpointsList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeEndpointsList_ManifestParameters(props *KubeEndpointsListProps) error { + return nil +} + +func validateKubeEndpointsList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeEndpointsListParameters(scope constructs.Construct, id *string, props *KubeEndpointsListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsProps.go new file mode 100644 index 0000000..a229370 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpointsProps.go @@ -0,0 +1,27 @@ +package k8s + + +// Endpoints is a collection of endpoints that implement the actual service. Example:. +// +// Name: "mysvc", +// Subsets: [ +// { +// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], +// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] +// }, +// { +// Addresses: [{"ip": "10.10.3.3"}], +// Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}] +// }, +// ]. +type KubeEndpointsProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // The set of all endpoints is the union of all subsets. + // + // Addresses are placed into subsets according to the IPs they share. A single address with multiple ports, some of which are ready and some of which are not (because they come from different containers) will result in the address being displayed in different subsets for the different ports. No address will appear in both Addresses and NotReadyAddresses in the same subset. Sets of addresses and ports that comprise a service. + Subsets *[]*EndpointSubset `field:"optional" json:"subsets" yaml:"subsets"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpoints__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpoints__checks.go new file mode 100644 index 0000000..e6a406e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpoints__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeEndpoints_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeEndpoints_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeEndpoints_ManifestParameters(props *KubeEndpointsProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeEndpoints_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeEndpointsParameters(scope constructs.Construct, id *string, props *KubeEndpointsProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpoints__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpoints__no_checks.go new file mode 100644 index 0000000..3ec5b85 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEndpoints__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeEndpoints_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeEndpoints_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeEndpoints_ManifestParameters(props *KubeEndpointsProps) error { + return nil +} + +func validateKubeEndpoints_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeEndpointsParameters(scope constructs.Construct, id *string, props *KubeEndpointsProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEvent.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEvent.go new file mode 100644 index 0000000..46345b2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEvent.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Event is a report of an event somewhere in the cluster. +// +// It generally denotes some state change in the system. Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data. +type KubeEvent interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeEvent +type jsiiProxy_KubeEvent struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeEvent) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEvent) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEvent) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEvent) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEvent) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEvent) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEvent) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.events.v1.Event" API object. +func NewKubeEvent(scope constructs.Construct, id *string, props *KubeEventProps) KubeEvent { + _init_.Initialize() + + if err := validateNewKubeEventParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeEvent{} + + _jsii_.Create( + "k8s.KubeEvent", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.events.v1.Event" API object. +func NewKubeEvent_Override(k KubeEvent, scope constructs.Construct, id *string, props *KubeEventProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeEvent", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeEvent_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEvent_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEvent", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeEvent_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEvent_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEvent", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.events.v1.Event". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeEvent_Manifest(props *KubeEventProps) interface{} { + _init_.Initialize() + + if err := validateKubeEvent_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeEvent", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeEvent_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeEvent_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeEvent", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeEvent_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeEvent", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeEvent) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeEvent) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeEvent) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeEvent) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEventList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEventList.go new file mode 100644 index 0000000..bc128ad --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEventList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// EventList is a list of Event objects. +type KubeEventList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeEventList +type jsiiProxy_KubeEventList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeEventList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEventList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEventList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEventList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEventList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEventList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEventList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.events.v1.EventList" API object. +func NewKubeEventList(scope constructs.Construct, id *string, props *KubeEventListProps) KubeEventList { + _init_.Initialize() + + if err := validateNewKubeEventListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeEventList{} + + _jsii_.Create( + "k8s.KubeEventList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.events.v1.EventList" API object. +func NewKubeEventList_Override(k KubeEventList, scope constructs.Construct, id *string, props *KubeEventListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeEventList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeEventList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEventList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEventList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeEventList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEventList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEventList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.events.v1.EventList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeEventList_Manifest(props *KubeEventListProps) interface{} { + _init_.Initialize() + + if err := validateKubeEventList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeEventList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeEventList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeEventList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeEventList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeEventList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeEventList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeEventList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeEventList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeEventList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeEventList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEventListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEventListProps.go new file mode 100644 index 0000000..baa1cb6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEventListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// EventList is a list of Event objects. +type KubeEventListProps struct { + // items is a list of schema objects. + Items *[]*KubeEventProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEventList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEventList__checks.go new file mode 100644 index 0000000..bd90541 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEventList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeEventList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeEventList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeEventList_ManifestParameters(props *KubeEventListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeEventList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeEventListParameters(scope constructs.Construct, id *string, props *KubeEventListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEventList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEventList__no_checks.go new file mode 100644 index 0000000..45303d4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEventList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeEventList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeEventList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeEventList_ManifestParameters(props *KubeEventListProps) error { + return nil +} + +func validateKubeEventList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeEventListParameters(scope constructs.Construct, id *string, props *KubeEventListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEventProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEventProps.go new file mode 100644 index 0000000..b24dda9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEventProps.go @@ -0,0 +1,58 @@ +package k8s + +import ( + "time" +) + +// Event is a report of an event somewhere in the cluster. +// +// It generally denotes some state change in the system. Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data. +type KubeEventProps struct { + // eventTime is the time when this Event was first observed. + // + // It is required. + EventTime *time.Time `field:"required" json:"eventTime" yaml:"eventTime"` + // action is what action was taken/failed regarding to the regarding object. + // + // It is machine-readable. This field cannot be empty for new Events and it can have at most 128 characters. + Action *string `field:"optional" json:"action" yaml:"action"` + // deprecatedCount is the deprecated field assuring backward compatibility with core.v1 Event type. + DeprecatedCount *float64 `field:"optional" json:"deprecatedCount" yaml:"deprecatedCount"` + // deprecatedFirstTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type. + DeprecatedFirstTimestamp *time.Time `field:"optional" json:"deprecatedFirstTimestamp" yaml:"deprecatedFirstTimestamp"` + // deprecatedLastTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type. + DeprecatedLastTimestamp *time.Time `field:"optional" json:"deprecatedLastTimestamp" yaml:"deprecatedLastTimestamp"` + // deprecatedSource is the deprecated field assuring backward compatibility with core.v1 Event type. + DeprecatedSource *EventSource `field:"optional" json:"deprecatedSource" yaml:"deprecatedSource"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // note is a human-readable description of the status of this operation. + // + // Maximal length of the note is 1kB, but libraries should be prepared to handle values up to 64kB. + Note *string `field:"optional" json:"note" yaml:"note"` + // reason is why the action was taken. + // + // It is human-readable. This field cannot be empty for new Events and it can have at most 128 characters. + Reason *string `field:"optional" json:"reason" yaml:"reason"` + // regarding contains the object this Event is about. + // + // In most cases it's an Object reporting controller implements, e.g. ReplicaSetController implements ReplicaSets and this event is emitted because it acts on some changes in a ReplicaSet object. + Regarding *ObjectReference `field:"optional" json:"regarding" yaml:"regarding"` + // related is the optional secondary object for more complex actions. + // + // E.g. when regarding object triggers a creation or deletion of related object. + Related *ObjectReference `field:"optional" json:"related" yaml:"related"` + // reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. This field cannot be empty for new Events. + ReportingController *string `field:"optional" json:"reportingController" yaml:"reportingController"` + // reportingInstance is the ID of the controller instance, e.g. `kubelet-xyzf`. This field cannot be empty for new Events and it can have at most 128 characters. + ReportingInstance *string `field:"optional" json:"reportingInstance" yaml:"reportingInstance"` + // series is data about the Event series this event represents or nil if it's a singleton Event. + Series *EventSeries `field:"optional" json:"series" yaml:"series"` + // type is the type of this event (Normal, Warning), new types could be added in the future. + // + // It is machine-readable. This field cannot be empty for new Events. + Type *string `field:"optional" json:"type" yaml:"type"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEvent__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEvent__checks.go new file mode 100644 index 0000000..877020e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEvent__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeEvent_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeEvent_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeEvent_ManifestParameters(props *KubeEventProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeEvent_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeEventParameters(scope constructs.Construct, id *string, props *KubeEventProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEvent__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEvent__no_checks.go new file mode 100644 index 0000000..1276eb1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEvent__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeEvent_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeEvent_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeEvent_ManifestParameters(props *KubeEventProps) error { + return nil +} + +func validateKubeEvent_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeEventParameters(scope constructs.Construct, id *string, props *KubeEventProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEviction.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEviction.go new file mode 100644 index 0000000..7a6b1de --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEviction.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Eviction evicts a pod from its node subject to certain policies and safety constraints. +// +// This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods//evictions. +type KubeEviction interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeEviction +type jsiiProxy_KubeEviction struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeEviction) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEviction) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEviction) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEviction) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEviction) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEviction) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeEviction) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.policy.v1.Eviction" API object. +func NewKubeEviction(scope constructs.Construct, id *string, props *KubeEvictionProps) KubeEviction { + _init_.Initialize() + + if err := validateNewKubeEvictionParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeEviction{} + + _jsii_.Create( + "k8s.KubeEviction", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.policy.v1.Eviction" API object. +func NewKubeEviction_Override(k KubeEviction, scope constructs.Construct, id *string, props *KubeEvictionProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeEviction", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeEviction_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEviction_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEviction", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeEviction_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeEviction_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeEviction", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.policy.v1.Eviction". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeEviction_Manifest(props *KubeEvictionProps) interface{} { + _init_.Initialize() + + if err := validateKubeEviction_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeEviction", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeEviction_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeEviction_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeEviction", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeEviction_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeEviction", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeEviction) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeEviction) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeEviction) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeEviction) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEvictionProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEvictionProps.go new file mode 100644 index 0000000..e2f62c9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEvictionProps.go @@ -0,0 +1,13 @@ +package k8s + + +// Eviction evicts a pod from its node subject to certain policies and safety constraints. +// +// This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods//evictions. +type KubeEvictionProps struct { + // DeleteOptions may be provided. + DeleteOptions *DeleteOptions `field:"optional" json:"deleteOptions" yaml:"deleteOptions"` + // ObjectMeta describes the pod that is being evicted. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEviction__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEviction__checks.go new file mode 100644 index 0000000..b5f1638 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEviction__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeEviction_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeEviction_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeEviction_ManifestParameters(props *KubeEvictionProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeEviction_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeEvictionParameters(scope constructs.Construct, id *string, props *KubeEvictionProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeEviction__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeEviction__no_checks.go new file mode 100644 index 0000000..26a94dc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeEviction__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeEviction_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeEviction_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeEviction_ManifestParameters(props *KubeEvictionProps) error { + return nil +} + +func validateKubeEviction_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeEvictionParameters(scope constructs.Construct, id *string, props *KubeEvictionProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1.go new file mode 100644 index 0000000..bea2ec6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// FlowSchemaList is a list of FlowSchema objects. +type KubeFlowSchemaListV1Beta1 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeFlowSchemaListV1Beta1 +type jsiiProxy_KubeFlowSchemaListV1Beta1 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta1) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta1) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta1) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta1) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta1) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta1) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta1) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.flowcontrol.v1beta1.FlowSchemaList" API object. +func NewKubeFlowSchemaListV1Beta1(scope constructs.Construct, id *string, props *KubeFlowSchemaListV1Beta1Props) KubeFlowSchemaListV1Beta1 { + _init_.Initialize() + + if err := validateNewKubeFlowSchemaListV1Beta1Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeFlowSchemaListV1Beta1{} + + _jsii_.Create( + "k8s.KubeFlowSchemaListV1Beta1", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.flowcontrol.v1beta1.FlowSchemaList" API object. +func NewKubeFlowSchemaListV1Beta1_Override(k KubeFlowSchemaListV1Beta1, scope constructs.Construct, id *string, props *KubeFlowSchemaListV1Beta1Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeFlowSchemaListV1Beta1", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeFlowSchemaListV1Beta1_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeFlowSchemaListV1Beta1_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaListV1Beta1", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeFlowSchemaListV1Beta1_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeFlowSchemaListV1Beta1_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaListV1Beta1", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.flowcontrol.v1beta1.FlowSchemaList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeFlowSchemaListV1Beta1_Manifest(props *KubeFlowSchemaListV1Beta1Props) interface{} { + _init_.Initialize() + + if err := validateKubeFlowSchemaListV1Beta1_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaListV1Beta1", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeFlowSchemaListV1Beta1_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeFlowSchemaListV1Beta1_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaListV1Beta1", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeFlowSchemaListV1Beta1_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeFlowSchemaListV1Beta1", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeFlowSchemaListV1Beta1) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeFlowSchemaListV1Beta1) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeFlowSchemaListV1Beta1) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeFlowSchemaListV1Beta1) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1Props.go new file mode 100644 index 0000000..623c74a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1Props.go @@ -0,0 +1,13 @@ +package k8s + + +// FlowSchemaList is a list of FlowSchema objects. +type KubeFlowSchemaListV1Beta1Props struct { + // `items` is a list of FlowSchemas. + Items *[]*KubeFlowSchemaV1Beta1Props `field:"required" json:"items" yaml:"items"` + // `metadata` is the standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1__checks.go new file mode 100644 index 0000000..cd5d5e7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeFlowSchemaListV1Beta1_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeFlowSchemaListV1Beta1_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeFlowSchemaListV1Beta1_ManifestParameters(props *KubeFlowSchemaListV1Beta1Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeFlowSchemaListV1Beta1_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeFlowSchemaListV1Beta1Parameters(scope constructs.Construct, id *string, props *KubeFlowSchemaListV1Beta1Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1__no_checks.go new file mode 100644 index 0000000..7036d16 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta1__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeFlowSchemaListV1Beta1_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeFlowSchemaListV1Beta1_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeFlowSchemaListV1Beta1_ManifestParameters(props *KubeFlowSchemaListV1Beta1Props) error { + return nil +} + +func validateKubeFlowSchemaListV1Beta1_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeFlowSchemaListV1Beta1Parameters(scope constructs.Construct, id *string, props *KubeFlowSchemaListV1Beta1Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2.go new file mode 100644 index 0000000..7a8c3f4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// FlowSchemaList is a list of FlowSchema objects. +type KubeFlowSchemaListV1Beta2 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeFlowSchemaListV1Beta2 +type jsiiProxy_KubeFlowSchemaListV1Beta2 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta2) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta2) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta2) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta2) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta2) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta2) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaListV1Beta2) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.flowcontrol.v1beta2.FlowSchemaList" API object. +func NewKubeFlowSchemaListV1Beta2(scope constructs.Construct, id *string, props *KubeFlowSchemaListV1Beta2Props) KubeFlowSchemaListV1Beta2 { + _init_.Initialize() + + if err := validateNewKubeFlowSchemaListV1Beta2Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeFlowSchemaListV1Beta2{} + + _jsii_.Create( + "k8s.KubeFlowSchemaListV1Beta2", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.flowcontrol.v1beta2.FlowSchemaList" API object. +func NewKubeFlowSchemaListV1Beta2_Override(k KubeFlowSchemaListV1Beta2, scope constructs.Construct, id *string, props *KubeFlowSchemaListV1Beta2Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeFlowSchemaListV1Beta2", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeFlowSchemaListV1Beta2_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeFlowSchemaListV1Beta2_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaListV1Beta2", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeFlowSchemaListV1Beta2_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeFlowSchemaListV1Beta2_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaListV1Beta2", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.flowcontrol.v1beta2.FlowSchemaList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeFlowSchemaListV1Beta2_Manifest(props *KubeFlowSchemaListV1Beta2Props) interface{} { + _init_.Initialize() + + if err := validateKubeFlowSchemaListV1Beta2_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaListV1Beta2", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeFlowSchemaListV1Beta2_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeFlowSchemaListV1Beta2_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaListV1Beta2", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeFlowSchemaListV1Beta2_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeFlowSchemaListV1Beta2", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeFlowSchemaListV1Beta2) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeFlowSchemaListV1Beta2) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeFlowSchemaListV1Beta2) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeFlowSchemaListV1Beta2) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2Props.go new file mode 100644 index 0000000..d70289b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2Props.go @@ -0,0 +1,13 @@ +package k8s + + +// FlowSchemaList is a list of FlowSchema objects. +type KubeFlowSchemaListV1Beta2Props struct { + // `items` is a list of FlowSchemas. + Items *[]*KubeFlowSchemaV1Beta2Props `field:"required" json:"items" yaml:"items"` + // `metadata` is the standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2__checks.go new file mode 100644 index 0000000..eabbf4d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeFlowSchemaListV1Beta2_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeFlowSchemaListV1Beta2_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeFlowSchemaListV1Beta2_ManifestParameters(props *KubeFlowSchemaListV1Beta2Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeFlowSchemaListV1Beta2_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeFlowSchemaListV1Beta2Parameters(scope constructs.Construct, id *string, props *KubeFlowSchemaListV1Beta2Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2__no_checks.go new file mode 100644 index 0000000..d434994 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaListV1Beta2__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeFlowSchemaListV1Beta2_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeFlowSchemaListV1Beta2_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeFlowSchemaListV1Beta2_ManifestParameters(props *KubeFlowSchemaListV1Beta2Props) error { + return nil +} + +func validateKubeFlowSchemaListV1Beta2_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeFlowSchemaListV1Beta2Parameters(scope constructs.Construct, id *string, props *KubeFlowSchemaListV1Beta2Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1.go new file mode 100644 index 0000000..3ab79fa --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// FlowSchema defines the schema of a group of flows. +// +// Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +type KubeFlowSchemaV1Beta1 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeFlowSchemaV1Beta1 +type jsiiProxy_KubeFlowSchemaV1Beta1 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta1) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta1) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta1) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta1) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta1) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta1) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta1) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.flowcontrol.v1beta1.FlowSchema" API object. +func NewKubeFlowSchemaV1Beta1(scope constructs.Construct, id *string, props *KubeFlowSchemaV1Beta1Props) KubeFlowSchemaV1Beta1 { + _init_.Initialize() + + if err := validateNewKubeFlowSchemaV1Beta1Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeFlowSchemaV1Beta1{} + + _jsii_.Create( + "k8s.KubeFlowSchemaV1Beta1", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.flowcontrol.v1beta1.FlowSchema" API object. +func NewKubeFlowSchemaV1Beta1_Override(k KubeFlowSchemaV1Beta1, scope constructs.Construct, id *string, props *KubeFlowSchemaV1Beta1Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeFlowSchemaV1Beta1", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeFlowSchemaV1Beta1_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeFlowSchemaV1Beta1_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaV1Beta1", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeFlowSchemaV1Beta1_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeFlowSchemaV1Beta1_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaV1Beta1", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.flowcontrol.v1beta1.FlowSchema". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeFlowSchemaV1Beta1_Manifest(props *KubeFlowSchemaV1Beta1Props) interface{} { + _init_.Initialize() + + if err := validateKubeFlowSchemaV1Beta1_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaV1Beta1", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeFlowSchemaV1Beta1_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeFlowSchemaV1Beta1_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaV1Beta1", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeFlowSchemaV1Beta1_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeFlowSchemaV1Beta1", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeFlowSchemaV1Beta1) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeFlowSchemaV1Beta1) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeFlowSchemaV1Beta1) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeFlowSchemaV1Beta1) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1Props.go new file mode 100644 index 0000000..d3c71bf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1Props.go @@ -0,0 +1,17 @@ +package k8s + + +// FlowSchema defines the schema of a group of flows. +// +// Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +type KubeFlowSchemaV1Beta1Props struct { + // `metadata` is the standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // `spec` is the specification of the desired behavior of a FlowSchema. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *FlowSchemaSpecV1Beta1 `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1__checks.go new file mode 100644 index 0000000..4d39816 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeFlowSchemaV1Beta1_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeFlowSchemaV1Beta1_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeFlowSchemaV1Beta1_ManifestParameters(props *KubeFlowSchemaV1Beta1Props) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeFlowSchemaV1Beta1_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeFlowSchemaV1Beta1Parameters(scope constructs.Construct, id *string, props *KubeFlowSchemaV1Beta1Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1__no_checks.go new file mode 100644 index 0000000..a89a2be --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta1__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeFlowSchemaV1Beta1_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeFlowSchemaV1Beta1_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeFlowSchemaV1Beta1_ManifestParameters(props *KubeFlowSchemaV1Beta1Props) error { + return nil +} + +func validateKubeFlowSchemaV1Beta1_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeFlowSchemaV1Beta1Parameters(scope constructs.Construct, id *string, props *KubeFlowSchemaV1Beta1Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2.go new file mode 100644 index 0000000..5f02062 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// FlowSchema defines the schema of a group of flows. +// +// Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +type KubeFlowSchemaV1Beta2 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeFlowSchemaV1Beta2 +type jsiiProxy_KubeFlowSchemaV1Beta2 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta2) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta2) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta2) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta2) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta2) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta2) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeFlowSchemaV1Beta2) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.flowcontrol.v1beta2.FlowSchema" API object. +func NewKubeFlowSchemaV1Beta2(scope constructs.Construct, id *string, props *KubeFlowSchemaV1Beta2Props) KubeFlowSchemaV1Beta2 { + _init_.Initialize() + + if err := validateNewKubeFlowSchemaV1Beta2Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeFlowSchemaV1Beta2{} + + _jsii_.Create( + "k8s.KubeFlowSchemaV1Beta2", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.flowcontrol.v1beta2.FlowSchema" API object. +func NewKubeFlowSchemaV1Beta2_Override(k KubeFlowSchemaV1Beta2, scope constructs.Construct, id *string, props *KubeFlowSchemaV1Beta2Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeFlowSchemaV1Beta2", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeFlowSchemaV1Beta2_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeFlowSchemaV1Beta2_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaV1Beta2", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeFlowSchemaV1Beta2_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeFlowSchemaV1Beta2_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaV1Beta2", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.flowcontrol.v1beta2.FlowSchema". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeFlowSchemaV1Beta2_Manifest(props *KubeFlowSchemaV1Beta2Props) interface{} { + _init_.Initialize() + + if err := validateKubeFlowSchemaV1Beta2_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaV1Beta2", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeFlowSchemaV1Beta2_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeFlowSchemaV1Beta2_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeFlowSchemaV1Beta2", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeFlowSchemaV1Beta2_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeFlowSchemaV1Beta2", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeFlowSchemaV1Beta2) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeFlowSchemaV1Beta2) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeFlowSchemaV1Beta2) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeFlowSchemaV1Beta2) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2Props.go new file mode 100644 index 0000000..21958b4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2Props.go @@ -0,0 +1,17 @@ +package k8s + + +// FlowSchema defines the schema of a group of flows. +// +// Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +type KubeFlowSchemaV1Beta2Props struct { + // `metadata` is the standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // `spec` is the specification of the desired behavior of a FlowSchema. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *FlowSchemaSpecV1Beta2 `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2__checks.go new file mode 100644 index 0000000..7af86b1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeFlowSchemaV1Beta2_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeFlowSchemaV1Beta2_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeFlowSchemaV1Beta2_ManifestParameters(props *KubeFlowSchemaV1Beta2Props) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeFlowSchemaV1Beta2_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeFlowSchemaV1Beta2Parameters(scope constructs.Construct, id *string, props *KubeFlowSchemaV1Beta2Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2__no_checks.go new file mode 100644 index 0000000..6bf4438 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeFlowSchemaV1Beta2__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeFlowSchemaV1Beta2_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeFlowSchemaV1Beta2_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeFlowSchemaV1Beta2_ManifestParameters(props *KubeFlowSchemaV1Beta2Props) error { + return nil +} + +func validateKubeFlowSchemaV1Beta2_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeFlowSchemaV1Beta2Parameters(scope constructs.Construct, id *string, props *KubeFlowSchemaV1Beta2Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscaler.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscaler.go new file mode 100644 index 0000000..bc1e383 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscaler.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// configuration of a horizontal pod autoscaler. +type KubeHorizontalPodAutoscaler interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeHorizontalPodAutoscaler +type jsiiProxy_KubeHorizontalPodAutoscaler struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscaler) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscaler) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscaler) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscaler) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscaler) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscaler) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscaler) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.autoscaling.v1.HorizontalPodAutoscaler" API object. +func NewKubeHorizontalPodAutoscaler(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerProps) KubeHorizontalPodAutoscaler { + _init_.Initialize() + + if err := validateNewKubeHorizontalPodAutoscalerParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeHorizontalPodAutoscaler{} + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscaler", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.autoscaling.v1.HorizontalPodAutoscaler" API object. +func NewKubeHorizontalPodAutoscaler_Override(k KubeHorizontalPodAutoscaler, scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscaler", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeHorizontalPodAutoscaler_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscaler_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscaler", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeHorizontalPodAutoscaler_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscaler_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscaler", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.autoscaling.v1.HorizontalPodAutoscaler". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeHorizontalPodAutoscaler_Manifest(props *KubeHorizontalPodAutoscalerProps) interface{} { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscaler_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscaler", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeHorizontalPodAutoscaler_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscaler_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscaler", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeHorizontalPodAutoscaler_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeHorizontalPodAutoscaler", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscaler) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscaler) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscaler) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscaler) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerList.go new file mode 100644 index 0000000..5c2fad4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// list of horizontal pod autoscaler objects. +type KubeHorizontalPodAutoscalerList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeHorizontalPodAutoscalerList +type jsiiProxy_KubeHorizontalPodAutoscalerList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.autoscaling.v1.HorizontalPodAutoscalerList" API object. +func NewKubeHorizontalPodAutoscalerList(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListProps) KubeHorizontalPodAutoscalerList { + _init_.Initialize() + + if err := validateNewKubeHorizontalPodAutoscalerListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeHorizontalPodAutoscalerList{} + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscalerList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.autoscaling.v1.HorizontalPodAutoscalerList" API object. +func NewKubeHorizontalPodAutoscalerList_Override(k KubeHorizontalPodAutoscalerList, scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscalerList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeHorizontalPodAutoscalerList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeHorizontalPodAutoscalerList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.autoscaling.v1.HorizontalPodAutoscalerList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeHorizontalPodAutoscalerList_Manifest(props *KubeHorizontalPodAutoscalerListProps) interface{} { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeHorizontalPodAutoscalerList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeHorizontalPodAutoscalerList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeHorizontalPodAutoscalerList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListProps.go new file mode 100644 index 0000000..3077caf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// list of horizontal pod autoscaler objects. +type KubeHorizontalPodAutoscalerListProps struct { + // list of horizontal pod autoscaler objects. + Items *[]*KubeHorizontalPodAutoscalerProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2.go new file mode 100644 index 0000000..42f5d36 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects. +type KubeHorizontalPodAutoscalerListV2 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeHorizontalPodAutoscalerListV2 +type jsiiProxy_KubeHorizontalPodAutoscalerListV2 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerList" API object. +func NewKubeHorizontalPodAutoscalerListV2(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListV2Props) KubeHorizontalPodAutoscalerListV2 { + _init_.Initialize() + + if err := validateNewKubeHorizontalPodAutoscalerListV2Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeHorizontalPodAutoscalerListV2{} + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscalerListV2", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerList" API object. +func NewKubeHorizontalPodAutoscalerListV2_Override(k KubeHorizontalPodAutoscalerListV2, scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListV2Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscalerListV2", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeHorizontalPodAutoscalerListV2_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerListV2_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerListV2", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeHorizontalPodAutoscalerListV2_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerListV2_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerListV2", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeHorizontalPodAutoscalerListV2_Manifest(props *KubeHorizontalPodAutoscalerListV2Props) interface{} { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerListV2_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerListV2", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeHorizontalPodAutoscalerListV2_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerListV2_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerListV2", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeHorizontalPodAutoscalerListV2_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeHorizontalPodAutoscalerListV2", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerListV2) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerListV2) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerListV2) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerListV2) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2.go new file mode 100644 index 0000000..387e836 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects. +type KubeHorizontalPodAutoscalerListV2Beta2 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeHorizontalPodAutoscalerListV2Beta2 +type jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerList" API object. +func NewKubeHorizontalPodAutoscalerListV2Beta2(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListV2Beta2Props) KubeHorizontalPodAutoscalerListV2Beta2 { + _init_.Initialize() + + if err := validateNewKubeHorizontalPodAutoscalerListV2Beta2Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2{} + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscalerListV2Beta2", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerList" API object. +func NewKubeHorizontalPodAutoscalerListV2Beta2_Override(k KubeHorizontalPodAutoscalerListV2Beta2, scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListV2Beta2Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscalerListV2Beta2", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeHorizontalPodAutoscalerListV2Beta2_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerListV2Beta2_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerListV2Beta2", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeHorizontalPodAutoscalerListV2Beta2_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerListV2Beta2_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerListV2Beta2", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeHorizontalPodAutoscalerListV2Beta2_Manifest(props *KubeHorizontalPodAutoscalerListV2Beta2Props) interface{} { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerListV2Beta2_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerListV2Beta2", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeHorizontalPodAutoscalerListV2Beta2_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerListV2Beta2_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerListV2Beta2", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeHorizontalPodAutoscalerListV2Beta2_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeHorizontalPodAutoscalerListV2Beta2", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2Props.go new file mode 100644 index 0000000..d124a77 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2Props.go @@ -0,0 +1,11 @@ +package k8s + + +// HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects. +type KubeHorizontalPodAutoscalerListV2Beta2Props struct { + // items is the list of horizontal pod autoscaler objects. + Items *[]*KubeHorizontalPodAutoscalerV2Beta2Props `field:"required" json:"items" yaml:"items"` + // metadata is the standard list metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2__checks.go new file mode 100644 index 0000000..b97a685 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeHorizontalPodAutoscalerListV2Beta2_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2Beta2_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2Beta2_ManifestParameters(props *KubeHorizontalPodAutoscalerListV2Beta2Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2Beta2_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeHorizontalPodAutoscalerListV2Beta2Parameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListV2Beta2Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2__no_checks.go new file mode 100644 index 0000000..debf1c6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Beta2__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeHorizontalPodAutoscalerListV2Beta2_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2Beta2_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2Beta2_ManifestParameters(props *KubeHorizontalPodAutoscalerListV2Beta2Props) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2Beta2_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeHorizontalPodAutoscalerListV2Beta2Parameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListV2Beta2Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Props.go new file mode 100644 index 0000000..d350343 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2Props.go @@ -0,0 +1,11 @@ +package k8s + + +// HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects. +type KubeHorizontalPodAutoscalerListV2Props struct { + // items is the list of horizontal pod autoscaler objects. + Items *[]*KubeHorizontalPodAutoscalerV2Props `field:"required" json:"items" yaml:"items"` + // metadata is the standard list metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2__checks.go new file mode 100644 index 0000000..4de48b1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeHorizontalPodAutoscalerListV2_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2_ManifestParameters(props *KubeHorizontalPodAutoscalerListV2Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeHorizontalPodAutoscalerListV2Parameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListV2Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2__no_checks.go new file mode 100644 index 0000000..2232359 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerListV2__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeHorizontalPodAutoscalerListV2_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2_ManifestParameters(props *KubeHorizontalPodAutoscalerListV2Props) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerListV2_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeHorizontalPodAutoscalerListV2Parameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListV2Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerList__checks.go new file mode 100644 index 0000000..2228da9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeHorizontalPodAutoscalerList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerList_ManifestParameters(props *KubeHorizontalPodAutoscalerListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeHorizontalPodAutoscalerListParameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerList__no_checks.go new file mode 100644 index 0000000..c1e44c9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeHorizontalPodAutoscalerList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerList_ManifestParameters(props *KubeHorizontalPodAutoscalerListProps) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeHorizontalPodAutoscalerListParameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerProps.go new file mode 100644 index 0000000..7683ed5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerProps.go @@ -0,0 +1,15 @@ +package k8s + + +// configuration of a horizontal pod autoscaler. +type KubeHorizontalPodAutoscalerProps struct { + // Standard object metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // behaviour of autoscaler. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + Spec *HorizontalPodAutoscalerSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2.go new file mode 100644 index 0000000..f091670 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// HorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified. +type KubeHorizontalPodAutoscalerV2 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeHorizontalPodAutoscalerV2 +type jsiiProxy_KubeHorizontalPodAutoscalerV2 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.autoscaling.v2.HorizontalPodAutoscaler" API object. +func NewKubeHorizontalPodAutoscalerV2(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerV2Props) KubeHorizontalPodAutoscalerV2 { + _init_.Initialize() + + if err := validateNewKubeHorizontalPodAutoscalerV2Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeHorizontalPodAutoscalerV2{} + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscalerV2", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.autoscaling.v2.HorizontalPodAutoscaler" API object. +func NewKubeHorizontalPodAutoscalerV2_Override(k KubeHorizontalPodAutoscalerV2, scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerV2Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscalerV2", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeHorizontalPodAutoscalerV2_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerV2_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerV2", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeHorizontalPodAutoscalerV2_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerV2_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerV2", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.autoscaling.v2.HorizontalPodAutoscaler". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeHorizontalPodAutoscalerV2_Manifest(props *KubeHorizontalPodAutoscalerV2Props) interface{} { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerV2_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerV2", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeHorizontalPodAutoscalerV2_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerV2_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerV2", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeHorizontalPodAutoscalerV2_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeHorizontalPodAutoscalerV2", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerV2) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerV2) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerV2) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerV2) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2.go new file mode 100644 index 0000000..cd37fc6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// HorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified. +type KubeHorizontalPodAutoscalerV2Beta2 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeHorizontalPodAutoscalerV2Beta2 +type jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscaler" API object. +func NewKubeHorizontalPodAutoscalerV2Beta2(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerV2Beta2Props) KubeHorizontalPodAutoscalerV2Beta2 { + _init_.Initialize() + + if err := validateNewKubeHorizontalPodAutoscalerV2Beta2Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2{} + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscalerV2Beta2", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscaler" API object. +func NewKubeHorizontalPodAutoscalerV2Beta2_Override(k KubeHorizontalPodAutoscalerV2Beta2, scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerV2Beta2Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeHorizontalPodAutoscalerV2Beta2", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeHorizontalPodAutoscalerV2Beta2_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerV2Beta2_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerV2Beta2", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeHorizontalPodAutoscalerV2Beta2_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerV2Beta2_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerV2Beta2", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscaler". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeHorizontalPodAutoscalerV2Beta2_Manifest(props *KubeHorizontalPodAutoscalerV2Beta2Props) interface{} { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerV2Beta2_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerV2Beta2", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeHorizontalPodAutoscalerV2Beta2_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeHorizontalPodAutoscalerV2Beta2_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeHorizontalPodAutoscalerV2Beta2", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeHorizontalPodAutoscalerV2Beta2_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeHorizontalPodAutoscalerV2Beta2", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2Props.go new file mode 100644 index 0000000..73d8295 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2Props.go @@ -0,0 +1,15 @@ +package k8s + + +// HorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified. +type KubeHorizontalPodAutoscalerV2Beta2Props struct { + // metadata is the standard object metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // spec is the specification for the behaviour of the autoscaler. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + Spec *HorizontalPodAutoscalerSpecV2Beta2 `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2__checks.go new file mode 100644 index 0000000..3774be1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeHorizontalPodAutoscalerV2Beta2_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerV2Beta2_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerV2Beta2_ManifestParameters(props *KubeHorizontalPodAutoscalerV2Beta2Props) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerV2Beta2_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeHorizontalPodAutoscalerV2Beta2Parameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerV2Beta2Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2__no_checks.go new file mode 100644 index 0000000..cfe444b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Beta2__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeHorizontalPodAutoscalerV2Beta2_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerV2Beta2_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerV2Beta2_ManifestParameters(props *KubeHorizontalPodAutoscalerV2Beta2Props) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerV2Beta2_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeHorizontalPodAutoscalerV2Beta2Parameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerV2Beta2Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Props.go new file mode 100644 index 0000000..42c3f4a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2Props.go @@ -0,0 +1,15 @@ +package k8s + + +// HorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified. +type KubeHorizontalPodAutoscalerV2Props struct { + // metadata is the standard object metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // spec is the specification for the behaviour of the autoscaler. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + Spec *HorizontalPodAutoscalerSpecV2 `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2__checks.go new file mode 100644 index 0000000..3f9158f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeHorizontalPodAutoscalerV2_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerV2_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerV2_ManifestParameters(props *KubeHorizontalPodAutoscalerV2Props) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeHorizontalPodAutoscalerV2_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeHorizontalPodAutoscalerV2Parameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerV2Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2__no_checks.go new file mode 100644 index 0000000..752890c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscalerV2__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeHorizontalPodAutoscalerV2_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerV2_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerV2_ManifestParameters(props *KubeHorizontalPodAutoscalerV2Props) error { + return nil +} + +func validateKubeHorizontalPodAutoscalerV2_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeHorizontalPodAutoscalerV2Parameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerV2Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscaler__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscaler__checks.go new file mode 100644 index 0000000..2fc45c6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscaler__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeHorizontalPodAutoscaler_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscaler_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeHorizontalPodAutoscaler_ManifestParameters(props *KubeHorizontalPodAutoscalerProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeHorizontalPodAutoscaler_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeHorizontalPodAutoscalerParameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscaler__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscaler__no_checks.go new file mode 100644 index 0000000..851a362 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeHorizontalPodAutoscaler__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeHorizontalPodAutoscaler_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscaler_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeHorizontalPodAutoscaler_ManifestParameters(props *KubeHorizontalPodAutoscalerProps) error { + return nil +} + +func validateKubeHorizontalPodAutoscaler_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeHorizontalPodAutoscalerParameters(scope constructs.Construct, id *string, props *KubeHorizontalPodAutoscalerProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngress.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngress.go new file mode 100644 index 0000000..d32107b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngress.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. +// +// An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc. +type KubeIngress interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeIngress +type jsiiProxy_KubeIngress struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeIngress) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngress) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngress) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngress) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngress) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngress) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngress) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.networking.v1.Ingress" API object. +func NewKubeIngress(scope constructs.Construct, id *string, props *KubeIngressProps) KubeIngress { + _init_.Initialize() + + if err := validateNewKubeIngressParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeIngress{} + + _jsii_.Create( + "k8s.KubeIngress", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.networking.v1.Ingress" API object. +func NewKubeIngress_Override(k KubeIngress, scope constructs.Construct, id *string, props *KubeIngressProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeIngress", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeIngress_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeIngress_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeIngress", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeIngress_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeIngress_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeIngress", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.networking.v1.Ingress". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeIngress_Manifest(props *KubeIngressProps) interface{} { + _init_.Initialize() + + if err := validateKubeIngress_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeIngress", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeIngress_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeIngress_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeIngress", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeIngress_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeIngress", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeIngress) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeIngress) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeIngress) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeIngress) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClass.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClass.go new file mode 100644 index 0000000..985f886 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClass.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// IngressClass represents the class of the Ingress, referenced by the Ingress Spec. +// +// The `ingressclass.kubernetes.io/is-default-class` annotation can be used to indicate that an IngressClass should be considered default. When a single IngressClass resource has this annotation set to true, new Ingress resources without a class specified will be assigned this default class. +type KubeIngressClass interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeIngressClass +type jsiiProxy_KubeIngressClass struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeIngressClass) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClass) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClass) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClass) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClass) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClass) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClass) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.networking.v1.IngressClass" API object. +func NewKubeIngressClass(scope constructs.Construct, id *string, props *KubeIngressClassProps) KubeIngressClass { + _init_.Initialize() + + if err := validateNewKubeIngressClassParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeIngressClass{} + + _jsii_.Create( + "k8s.KubeIngressClass", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.networking.v1.IngressClass" API object. +func NewKubeIngressClass_Override(k KubeIngressClass, scope constructs.Construct, id *string, props *KubeIngressClassProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeIngressClass", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeIngressClass_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeIngressClass_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeIngressClass", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeIngressClass_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeIngressClass_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeIngressClass", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.networking.v1.IngressClass". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeIngressClass_Manifest(props *KubeIngressClassProps) interface{} { + _init_.Initialize() + + if err := validateKubeIngressClass_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeIngressClass", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeIngressClass_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeIngressClass_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeIngressClass", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeIngressClass_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeIngressClass", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeIngressClass) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeIngressClass) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeIngressClass) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeIngressClass) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassList.go new file mode 100644 index 0000000..9043f94 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// IngressClassList is a collection of IngressClasses. +type KubeIngressClassList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeIngressClassList +type jsiiProxy_KubeIngressClassList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeIngressClassList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClassList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClassList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClassList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClassList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClassList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressClassList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.networking.v1.IngressClassList" API object. +func NewKubeIngressClassList(scope constructs.Construct, id *string, props *KubeIngressClassListProps) KubeIngressClassList { + _init_.Initialize() + + if err := validateNewKubeIngressClassListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeIngressClassList{} + + _jsii_.Create( + "k8s.KubeIngressClassList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.networking.v1.IngressClassList" API object. +func NewKubeIngressClassList_Override(k KubeIngressClassList, scope constructs.Construct, id *string, props *KubeIngressClassListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeIngressClassList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeIngressClassList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeIngressClassList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeIngressClassList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeIngressClassList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeIngressClassList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeIngressClassList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.networking.v1.IngressClassList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeIngressClassList_Manifest(props *KubeIngressClassListProps) interface{} { + _init_.Initialize() + + if err := validateKubeIngressClassList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeIngressClassList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeIngressClassList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeIngressClassList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeIngressClassList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeIngressClassList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeIngressClassList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeIngressClassList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeIngressClassList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeIngressClassList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeIngressClassList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassListProps.go new file mode 100644 index 0000000..aaf45d2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// IngressClassList is a collection of IngressClasses. +type KubeIngressClassListProps struct { + // Items is the list of IngressClasses. + Items *[]*KubeIngressClassProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassList__checks.go new file mode 100644 index 0000000..6d69425 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeIngressClassList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeIngressClassList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeIngressClassList_ManifestParameters(props *KubeIngressClassListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeIngressClassList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeIngressClassListParameters(scope constructs.Construct, id *string, props *KubeIngressClassListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassList__no_checks.go new file mode 100644 index 0000000..a8a73d7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeIngressClassList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeIngressClassList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeIngressClassList_ManifestParameters(props *KubeIngressClassListProps) error { + return nil +} + +func validateKubeIngressClassList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeIngressClassListParameters(scope constructs.Construct, id *string, props *KubeIngressClassListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassProps.go new file mode 100644 index 0000000..c85c4b8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClassProps.go @@ -0,0 +1,17 @@ +package k8s + + +// IngressClass represents the class of the Ingress, referenced by the Ingress Spec. +// +// The `ingressclass.kubernetes.io/is-default-class` annotation can be used to indicate that an IngressClass should be considered default. When a single IngressClass resource has this annotation set to true, new Ingress resources without a class specified will be assigned this default class. +type KubeIngressClassProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec is the desired state of the IngressClass. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *IngressClassSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClass__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClass__checks.go new file mode 100644 index 0000000..ddd1acd --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClass__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeIngressClass_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeIngressClass_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeIngressClass_ManifestParameters(props *KubeIngressClassProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeIngressClass_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeIngressClassParameters(scope constructs.Construct, id *string, props *KubeIngressClassProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClass__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClass__no_checks.go new file mode 100644 index 0000000..35717b7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressClass__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeIngressClass_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeIngressClass_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeIngressClass_ManifestParameters(props *KubeIngressClassProps) error { + return nil +} + +func validateKubeIngressClass_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeIngressClassParameters(scope constructs.Construct, id *string, props *KubeIngressClassProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressList.go new file mode 100644 index 0000000..9eff87b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// IngressList is a collection of Ingress. +type KubeIngressList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeIngressList +type jsiiProxy_KubeIngressList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeIngressList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeIngressList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.networking.v1.IngressList" API object. +func NewKubeIngressList(scope constructs.Construct, id *string, props *KubeIngressListProps) KubeIngressList { + _init_.Initialize() + + if err := validateNewKubeIngressListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeIngressList{} + + _jsii_.Create( + "k8s.KubeIngressList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.networking.v1.IngressList" API object. +func NewKubeIngressList_Override(k KubeIngressList, scope constructs.Construct, id *string, props *KubeIngressListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeIngressList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeIngressList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeIngressList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeIngressList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeIngressList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeIngressList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeIngressList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.networking.v1.IngressList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeIngressList_Manifest(props *KubeIngressListProps) interface{} { + _init_.Initialize() + + if err := validateKubeIngressList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeIngressList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeIngressList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeIngressList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeIngressList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeIngressList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeIngressList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeIngressList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeIngressList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeIngressList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeIngressList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressListProps.go new file mode 100644 index 0000000..2a2f358 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// IngressList is a collection of Ingress. +type KubeIngressListProps struct { + // Items is the list of Ingress. + Items *[]*KubeIngressProps `field:"required" json:"items" yaml:"items"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressList__checks.go new file mode 100644 index 0000000..b18e6ad --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeIngressList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeIngressList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeIngressList_ManifestParameters(props *KubeIngressListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeIngressList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeIngressListParameters(scope constructs.Construct, id *string, props *KubeIngressListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressList__no_checks.go new file mode 100644 index 0000000..e49a7e4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeIngressList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeIngressList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeIngressList_ManifestParameters(props *KubeIngressListProps) error { + return nil +} + +func validateKubeIngressList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeIngressListParameters(scope constructs.Construct, id *string, props *KubeIngressListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressProps.go new file mode 100644 index 0000000..9063abc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngressProps.go @@ -0,0 +1,17 @@ +package k8s + + +// Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. +// +// An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc. +type KubeIngressProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec is the desired state of the Ingress. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *IngressSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngress__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngress__checks.go new file mode 100644 index 0000000..c17d269 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngress__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeIngress_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeIngress_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeIngress_ManifestParameters(props *KubeIngressProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeIngress_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeIngressParameters(scope constructs.Construct, id *string, props *KubeIngressProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeIngress__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngress__no_checks.go new file mode 100644 index 0000000..fe379ef --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeIngress__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeIngress_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeIngress_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeIngress_ManifestParameters(props *KubeIngressProps) error { + return nil +} + +func validateKubeIngress_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeIngressParameters(scope constructs.Construct, id *string, props *KubeIngressProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeJob.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeJob.go new file mode 100644 index 0000000..c9d89e2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeJob.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Job represents the configuration of a single job. +type KubeJob interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeJob +type jsiiProxy_KubeJob struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeJob) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJob) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJob) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJob) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJob) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJob) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJob) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.batch.v1.Job" API object. +func NewKubeJob(scope constructs.Construct, id *string, props *KubeJobProps) KubeJob { + _init_.Initialize() + + if err := validateNewKubeJobParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeJob{} + + _jsii_.Create( + "k8s.KubeJob", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.batch.v1.Job" API object. +func NewKubeJob_Override(k KubeJob, scope constructs.Construct, id *string, props *KubeJobProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeJob", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeJob_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeJob_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeJob", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeJob_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeJob_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeJob", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.batch.v1.Job". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeJob_Manifest(props *KubeJobProps) interface{} { + _init_.Initialize() + + if err := validateKubeJob_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeJob", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeJob_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeJob_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeJob", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeJob_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeJob", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeJob) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeJob) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeJob) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeJob) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeJobList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeJobList.go new file mode 100644 index 0000000..e19ed05 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeJobList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// JobList is a collection of jobs. +type KubeJobList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeJobList +type jsiiProxy_KubeJobList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeJobList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJobList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJobList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJobList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJobList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJobList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeJobList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.batch.v1.JobList" API object. +func NewKubeJobList(scope constructs.Construct, id *string, props *KubeJobListProps) KubeJobList { + _init_.Initialize() + + if err := validateNewKubeJobListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeJobList{} + + _jsii_.Create( + "k8s.KubeJobList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.batch.v1.JobList" API object. +func NewKubeJobList_Override(k KubeJobList, scope constructs.Construct, id *string, props *KubeJobListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeJobList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeJobList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeJobList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeJobList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeJobList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeJobList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeJobList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.batch.v1.JobList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeJobList_Manifest(props *KubeJobListProps) interface{} { + _init_.Initialize() + + if err := validateKubeJobList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeJobList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeJobList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeJobList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeJobList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeJobList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeJobList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeJobList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeJobList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeJobList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeJobList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeJobListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeJobListProps.go new file mode 100644 index 0000000..c75fa6f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeJobListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// JobList is a collection of jobs. +type KubeJobListProps struct { + // items is the list of Jobs. + Items *[]*KubeJobProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeJobList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeJobList__checks.go new file mode 100644 index 0000000..e082b07 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeJobList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeJobList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeJobList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeJobList_ManifestParameters(props *KubeJobListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeJobList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeJobListParameters(scope constructs.Construct, id *string, props *KubeJobListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeJobList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeJobList__no_checks.go new file mode 100644 index 0000000..1c521c3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeJobList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeJobList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeJobList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeJobList_ManifestParameters(props *KubeJobListProps) error { + return nil +} + +func validateKubeJobList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeJobListParameters(scope constructs.Construct, id *string, props *KubeJobListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeJobProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeJobProps.go new file mode 100644 index 0000000..0c1e1db --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeJobProps.go @@ -0,0 +1,15 @@ +package k8s + + +// Job represents the configuration of a single job. +type KubeJobProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Specification of the desired behavior of a job. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *JobSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeJob__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeJob__checks.go new file mode 100644 index 0000000..d3181bb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeJob__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeJob_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeJob_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeJob_ManifestParameters(props *KubeJobProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeJob_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeJobParameters(scope constructs.Construct, id *string, props *KubeJobProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeJob__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeJob__no_checks.go new file mode 100644 index 0000000..4e00f4f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeJob__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeJob_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeJob_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeJob_ManifestParameters(props *KubeJobProps) error { + return nil +} + +func validateKubeJob_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeJobParameters(scope constructs.Construct, id *string, props *KubeJobProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLease.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLease.go new file mode 100644 index 0000000..8002eed --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLease.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Lease defines a lease concept. +type KubeLease interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeLease +type jsiiProxy_KubeLease struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeLease) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLease) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLease) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLease) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLease) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLease) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLease) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.coordination.v1.Lease" API object. +func NewKubeLease(scope constructs.Construct, id *string, props *KubeLeaseProps) KubeLease { + _init_.Initialize() + + if err := validateNewKubeLeaseParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeLease{} + + _jsii_.Create( + "k8s.KubeLease", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.coordination.v1.Lease" API object. +func NewKubeLease_Override(k KubeLease, scope constructs.Construct, id *string, props *KubeLeaseProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeLease", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeLease_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeLease_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeLease", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeLease_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeLease_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeLease", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.coordination.v1.Lease". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeLease_Manifest(props *KubeLeaseProps) interface{} { + _init_.Initialize() + + if err := validateKubeLease_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeLease", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeLease_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeLease_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeLease", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeLease_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeLease", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeLease) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeLease) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeLease) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeLease) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseList.go new file mode 100644 index 0000000..a669f7a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// LeaseList is a list of Lease objects. +type KubeLeaseList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeLeaseList +type jsiiProxy_KubeLeaseList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeLeaseList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLeaseList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLeaseList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLeaseList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLeaseList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLeaseList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLeaseList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.coordination.v1.LeaseList" API object. +func NewKubeLeaseList(scope constructs.Construct, id *string, props *KubeLeaseListProps) KubeLeaseList { + _init_.Initialize() + + if err := validateNewKubeLeaseListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeLeaseList{} + + _jsii_.Create( + "k8s.KubeLeaseList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.coordination.v1.LeaseList" API object. +func NewKubeLeaseList_Override(k KubeLeaseList, scope constructs.Construct, id *string, props *KubeLeaseListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeLeaseList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeLeaseList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeLeaseList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeLeaseList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeLeaseList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeLeaseList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeLeaseList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.coordination.v1.LeaseList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeLeaseList_Manifest(props *KubeLeaseListProps) interface{} { + _init_.Initialize() + + if err := validateKubeLeaseList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeLeaseList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeLeaseList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeLeaseList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeLeaseList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeLeaseList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeLeaseList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeLeaseList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeLeaseList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeLeaseList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeLeaseList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseListProps.go new file mode 100644 index 0000000..5ce5add --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// LeaseList is a list of Lease objects. +type KubeLeaseListProps struct { + // Items is a list of schema objects. + Items *[]*KubeLeaseProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseList__checks.go new file mode 100644 index 0000000..d0caa3b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeLeaseList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeLeaseList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeLeaseList_ManifestParameters(props *KubeLeaseListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeLeaseList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeLeaseListParameters(scope constructs.Construct, id *string, props *KubeLeaseListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseList__no_checks.go new file mode 100644 index 0000000..b0722cc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeLeaseList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeLeaseList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeLeaseList_ManifestParameters(props *KubeLeaseListProps) error { + return nil +} + +func validateKubeLeaseList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeLeaseListParameters(scope constructs.Construct, id *string, props *KubeLeaseListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseProps.go new file mode 100644 index 0000000..8904c79 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLeaseProps.go @@ -0,0 +1,13 @@ +package k8s + + +// Lease defines a lease concept. +type KubeLeaseProps struct { + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Specification of the Lease. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *LeaseSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLease__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLease__checks.go new file mode 100644 index 0000000..e9babb8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLease__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeLease_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeLease_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeLease_ManifestParameters(props *KubeLeaseProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeLease_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeLeaseParameters(scope constructs.Construct, id *string, props *KubeLeaseProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLease__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLease__no_checks.go new file mode 100644 index 0000000..480a645 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLease__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeLease_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeLease_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeLease_ManifestParameters(props *KubeLeaseProps) error { + return nil +} + +func validateKubeLease_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeLeaseParameters(scope constructs.Construct, id *string, props *KubeLeaseProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRange.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRange.go new file mode 100644 index 0000000..e2a0282 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRange.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// LimitRange sets resource usage limits for each kind of resource in a Namespace. +type KubeLimitRange interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeLimitRange +type jsiiProxy_KubeLimitRange struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeLimitRange) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRange) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRange) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRange) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRange) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRange) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRange) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.LimitRange" API object. +func NewKubeLimitRange(scope constructs.Construct, id *string, props *KubeLimitRangeProps) KubeLimitRange { + _init_.Initialize() + + if err := validateNewKubeLimitRangeParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeLimitRange{} + + _jsii_.Create( + "k8s.KubeLimitRange", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.LimitRange" API object. +func NewKubeLimitRange_Override(k KubeLimitRange, scope constructs.Construct, id *string, props *KubeLimitRangeProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeLimitRange", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeLimitRange_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeLimitRange_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeLimitRange", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeLimitRange_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeLimitRange_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeLimitRange", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.LimitRange". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeLimitRange_Manifest(props *KubeLimitRangeProps) interface{} { + _init_.Initialize() + + if err := validateKubeLimitRange_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeLimitRange", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeLimitRange_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeLimitRange_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeLimitRange", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeLimitRange_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeLimitRange", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeLimitRange) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeLimitRange) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeLimitRange) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeLimitRange) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeList.go new file mode 100644 index 0000000..8878d6b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// LimitRangeList is a list of LimitRange items. +type KubeLimitRangeList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeLimitRangeList +type jsiiProxy_KubeLimitRangeList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeLimitRangeList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRangeList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRangeList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRangeList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRangeList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRangeList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLimitRangeList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.LimitRangeList" API object. +func NewKubeLimitRangeList(scope constructs.Construct, id *string, props *KubeLimitRangeListProps) KubeLimitRangeList { + _init_.Initialize() + + if err := validateNewKubeLimitRangeListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeLimitRangeList{} + + _jsii_.Create( + "k8s.KubeLimitRangeList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.LimitRangeList" API object. +func NewKubeLimitRangeList_Override(k KubeLimitRangeList, scope constructs.Construct, id *string, props *KubeLimitRangeListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeLimitRangeList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeLimitRangeList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeLimitRangeList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeLimitRangeList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeLimitRangeList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeLimitRangeList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeLimitRangeList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.LimitRangeList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeLimitRangeList_Manifest(props *KubeLimitRangeListProps) interface{} { + _init_.Initialize() + + if err := validateKubeLimitRangeList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeLimitRangeList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeLimitRangeList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeLimitRangeList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeLimitRangeList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeLimitRangeList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeLimitRangeList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeLimitRangeList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeLimitRangeList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeLimitRangeList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeLimitRangeList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeListProps.go new file mode 100644 index 0000000..1cb537a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// LimitRangeList is a list of LimitRange items. +type KubeLimitRangeListProps struct { + // Items is a list of LimitRange objects. + // + // More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + Items *[]*KubeLimitRangeProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeList__checks.go new file mode 100644 index 0000000..e455874 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeLimitRangeList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeLimitRangeList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeLimitRangeList_ManifestParameters(props *KubeLimitRangeListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeLimitRangeList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeLimitRangeListParameters(scope constructs.Construct, id *string, props *KubeLimitRangeListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeList__no_checks.go new file mode 100644 index 0000000..baebb1e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeLimitRangeList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeLimitRangeList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeLimitRangeList_ManifestParameters(props *KubeLimitRangeListProps) error { + return nil +} + +func validateKubeLimitRangeList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeLimitRangeListParameters(scope constructs.Construct, id *string, props *KubeLimitRangeListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeProps.go new file mode 100644 index 0000000..da800c2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRangeProps.go @@ -0,0 +1,15 @@ +package k8s + + +// LimitRange sets resource usage limits for each kind of resource in a Namespace. +type KubeLimitRangeProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec defines the limits enforced. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *LimitRangeSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRange__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRange__checks.go new file mode 100644 index 0000000..d57dad1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRange__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeLimitRange_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeLimitRange_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeLimitRange_ManifestParameters(props *KubeLimitRangeProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeLimitRange_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeLimitRangeParameters(scope constructs.Construct, id *string, props *KubeLimitRangeProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRange__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRange__no_checks.go new file mode 100644 index 0000000..39eb8ca --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLimitRange__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeLimitRange_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeLimitRange_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeLimitRange_ManifestParameters(props *KubeLimitRangeProps) error { + return nil +} + +func validateKubeLimitRange_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeLimitRangeParameters(scope constructs.Construct, id *string, props *KubeLimitRangeProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReview.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReview.go new file mode 100644 index 0000000..4a75d88 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReview.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. +// +// Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking. +type KubeLocalSubjectAccessReview interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeLocalSubjectAccessReview +type jsiiProxy_KubeLocalSubjectAccessReview struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeLocalSubjectAccessReview) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLocalSubjectAccessReview) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLocalSubjectAccessReview) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLocalSubjectAccessReview) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLocalSubjectAccessReview) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLocalSubjectAccessReview) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeLocalSubjectAccessReview) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.authorization.v1.LocalSubjectAccessReview" API object. +func NewKubeLocalSubjectAccessReview(scope constructs.Construct, id *string, props *KubeLocalSubjectAccessReviewProps) KubeLocalSubjectAccessReview { + _init_.Initialize() + + if err := validateNewKubeLocalSubjectAccessReviewParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeLocalSubjectAccessReview{} + + _jsii_.Create( + "k8s.KubeLocalSubjectAccessReview", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.authorization.v1.LocalSubjectAccessReview" API object. +func NewKubeLocalSubjectAccessReview_Override(k KubeLocalSubjectAccessReview, scope constructs.Construct, id *string, props *KubeLocalSubjectAccessReviewProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeLocalSubjectAccessReview", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeLocalSubjectAccessReview_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeLocalSubjectAccessReview_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeLocalSubjectAccessReview", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeLocalSubjectAccessReview_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeLocalSubjectAccessReview_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeLocalSubjectAccessReview", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.authorization.v1.LocalSubjectAccessReview". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeLocalSubjectAccessReview_Manifest(props *KubeLocalSubjectAccessReviewProps) interface{} { + _init_.Initialize() + + if err := validateKubeLocalSubjectAccessReview_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeLocalSubjectAccessReview", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeLocalSubjectAccessReview_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeLocalSubjectAccessReview_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeLocalSubjectAccessReview", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeLocalSubjectAccessReview_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeLocalSubjectAccessReview", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeLocalSubjectAccessReview) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeLocalSubjectAccessReview) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeLocalSubjectAccessReview) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeLocalSubjectAccessReview) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReviewProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReviewProps.go new file mode 100644 index 0000000..8d801f1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReviewProps.go @@ -0,0 +1,17 @@ +package k8s + + +// LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. +// +// Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking. +type KubeLocalSubjectAccessReviewProps struct { + // Spec holds information about the request being evaluated. + // + // spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted. + Spec *SubjectAccessReviewSpec `field:"required" json:"spec" yaml:"spec"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReview__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReview__checks.go new file mode 100644 index 0000000..c2d2f7e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReview__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeLocalSubjectAccessReview_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeLocalSubjectAccessReview_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeLocalSubjectAccessReview_ManifestParameters(props *KubeLocalSubjectAccessReviewProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeLocalSubjectAccessReview_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeLocalSubjectAccessReviewParameters(scope constructs.Construct, id *string, props *KubeLocalSubjectAccessReviewProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReview__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReview__no_checks.go new file mode 100644 index 0000000..05022f1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeLocalSubjectAccessReview__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeLocalSubjectAccessReview_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeLocalSubjectAccessReview_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeLocalSubjectAccessReview_ManifestParameters(props *KubeLocalSubjectAccessReviewProps) error { + return nil +} + +func validateKubeLocalSubjectAccessReview_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeLocalSubjectAccessReviewParameters(scope constructs.Construct, id *string, props *KubeLocalSubjectAccessReviewProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfiguration.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfiguration.go new file mode 100644 index 0000000..ae02e8b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfiguration.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. +type KubeMutatingWebhookConfiguration interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeMutatingWebhookConfiguration +type jsiiProxy_KubeMutatingWebhookConfiguration struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeMutatingWebhookConfiguration) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfiguration) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfiguration) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfiguration) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfiguration) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfiguration) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfiguration) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.admissionregistration.v1.MutatingWebhookConfiguration" API object. +func NewKubeMutatingWebhookConfiguration(scope constructs.Construct, id *string, props *KubeMutatingWebhookConfigurationProps) KubeMutatingWebhookConfiguration { + _init_.Initialize() + + if err := validateNewKubeMutatingWebhookConfigurationParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeMutatingWebhookConfiguration{} + + _jsii_.Create( + "k8s.KubeMutatingWebhookConfiguration", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.admissionregistration.v1.MutatingWebhookConfiguration" API object. +func NewKubeMutatingWebhookConfiguration_Override(k KubeMutatingWebhookConfiguration, scope constructs.Construct, id *string, props *KubeMutatingWebhookConfigurationProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeMutatingWebhookConfiguration", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeMutatingWebhookConfiguration_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeMutatingWebhookConfiguration_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeMutatingWebhookConfiguration", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeMutatingWebhookConfiguration_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeMutatingWebhookConfiguration_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeMutatingWebhookConfiguration", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.admissionregistration.v1.MutatingWebhookConfiguration". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeMutatingWebhookConfiguration_Manifest(props *KubeMutatingWebhookConfigurationProps) interface{} { + _init_.Initialize() + + if err := validateKubeMutatingWebhookConfiguration_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeMutatingWebhookConfiguration", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeMutatingWebhookConfiguration_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeMutatingWebhookConfiguration_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeMutatingWebhookConfiguration", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeMutatingWebhookConfiguration_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeMutatingWebhookConfiguration", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeMutatingWebhookConfiguration) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeMutatingWebhookConfiguration) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeMutatingWebhookConfiguration) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeMutatingWebhookConfiguration) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationList.go new file mode 100644 index 0000000..5e2a483 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration. +type KubeMutatingWebhookConfigurationList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeMutatingWebhookConfigurationList +type jsiiProxy_KubeMutatingWebhookConfigurationList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeMutatingWebhookConfigurationList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfigurationList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfigurationList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfigurationList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfigurationList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfigurationList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeMutatingWebhookConfigurationList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.admissionregistration.v1.MutatingWebhookConfigurationList" API object. +func NewKubeMutatingWebhookConfigurationList(scope constructs.Construct, id *string, props *KubeMutatingWebhookConfigurationListProps) KubeMutatingWebhookConfigurationList { + _init_.Initialize() + + if err := validateNewKubeMutatingWebhookConfigurationListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeMutatingWebhookConfigurationList{} + + _jsii_.Create( + "k8s.KubeMutatingWebhookConfigurationList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.admissionregistration.v1.MutatingWebhookConfigurationList" API object. +func NewKubeMutatingWebhookConfigurationList_Override(k KubeMutatingWebhookConfigurationList, scope constructs.Construct, id *string, props *KubeMutatingWebhookConfigurationListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeMutatingWebhookConfigurationList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeMutatingWebhookConfigurationList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeMutatingWebhookConfigurationList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeMutatingWebhookConfigurationList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeMutatingWebhookConfigurationList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeMutatingWebhookConfigurationList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeMutatingWebhookConfigurationList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.admissionregistration.v1.MutatingWebhookConfigurationList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeMutatingWebhookConfigurationList_Manifest(props *KubeMutatingWebhookConfigurationListProps) interface{} { + _init_.Initialize() + + if err := validateKubeMutatingWebhookConfigurationList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeMutatingWebhookConfigurationList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeMutatingWebhookConfigurationList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeMutatingWebhookConfigurationList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeMutatingWebhookConfigurationList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeMutatingWebhookConfigurationList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeMutatingWebhookConfigurationList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeMutatingWebhookConfigurationList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeMutatingWebhookConfigurationList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeMutatingWebhookConfigurationList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeMutatingWebhookConfigurationList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationListProps.go new file mode 100644 index 0000000..9b6826e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration. +type KubeMutatingWebhookConfigurationListProps struct { + // List of MutatingWebhookConfiguration. + Items *[]*KubeMutatingWebhookConfigurationProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationList__checks.go new file mode 100644 index 0000000..19fe8dc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeMutatingWebhookConfigurationList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeMutatingWebhookConfigurationList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeMutatingWebhookConfigurationList_ManifestParameters(props *KubeMutatingWebhookConfigurationListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeMutatingWebhookConfigurationList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeMutatingWebhookConfigurationListParameters(scope constructs.Construct, id *string, props *KubeMutatingWebhookConfigurationListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationList__no_checks.go new file mode 100644 index 0000000..c27bf84 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeMutatingWebhookConfigurationList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeMutatingWebhookConfigurationList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeMutatingWebhookConfigurationList_ManifestParameters(props *KubeMutatingWebhookConfigurationListProps) error { + return nil +} + +func validateKubeMutatingWebhookConfigurationList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeMutatingWebhookConfigurationListParameters(scope constructs.Construct, id *string, props *KubeMutatingWebhookConfigurationListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationProps.go new file mode 100644 index 0000000..30abc9e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfigurationProps.go @@ -0,0 +1,13 @@ +package k8s + + +// MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. +type KubeMutatingWebhookConfigurationProps struct { + // Standard object metadata; + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Webhooks is a list of webhooks and the affected resources and operations. + Webhooks *[]*MutatingWebhook `field:"optional" json:"webhooks" yaml:"webhooks"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfiguration__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfiguration__checks.go new file mode 100644 index 0000000..8a9b15b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfiguration__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeMutatingWebhookConfiguration_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeMutatingWebhookConfiguration_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeMutatingWebhookConfiguration_ManifestParameters(props *KubeMutatingWebhookConfigurationProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeMutatingWebhookConfiguration_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeMutatingWebhookConfigurationParameters(scope constructs.Construct, id *string, props *KubeMutatingWebhookConfigurationProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfiguration__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfiguration__no_checks.go new file mode 100644 index 0000000..c4dc177 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeMutatingWebhookConfiguration__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeMutatingWebhookConfiguration_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeMutatingWebhookConfiguration_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeMutatingWebhookConfiguration_ManifestParameters(props *KubeMutatingWebhookConfigurationProps) error { + return nil +} + +func validateKubeMutatingWebhookConfiguration_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeMutatingWebhookConfigurationParameters(scope constructs.Construct, id *string, props *KubeMutatingWebhookConfigurationProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespace.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespace.go new file mode 100644 index 0000000..2893eba --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespace.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Namespace provides a scope for Names. +// +// Use of multiple namespaces is optional. +type KubeNamespace interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeNamespace +type jsiiProxy_KubeNamespace struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeNamespace) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespace) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespace) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespace) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespace) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespace) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespace) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.Namespace" API object. +func NewKubeNamespace(scope constructs.Construct, id *string, props *KubeNamespaceProps) KubeNamespace { + _init_.Initialize() + + if err := validateNewKubeNamespaceParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeNamespace{} + + _jsii_.Create( + "k8s.KubeNamespace", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.Namespace" API object. +func NewKubeNamespace_Override(k KubeNamespace, scope constructs.Construct, id *string, props *KubeNamespaceProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeNamespace", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeNamespace_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNamespace_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNamespace", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeNamespace_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNamespace_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNamespace", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.Namespace". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeNamespace_Manifest(props *KubeNamespaceProps) interface{} { + _init_.Initialize() + + if err := validateKubeNamespace_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeNamespace", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeNamespace_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeNamespace_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeNamespace", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeNamespace_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeNamespace", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeNamespace) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeNamespace) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeNamespace) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeNamespace) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceList.go new file mode 100644 index 0000000..2f86605 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// NamespaceList is a list of Namespaces. +type KubeNamespaceList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeNamespaceList +type jsiiProxy_KubeNamespaceList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeNamespaceList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespaceList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespaceList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespaceList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespaceList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespaceList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNamespaceList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.NamespaceList" API object. +func NewKubeNamespaceList(scope constructs.Construct, id *string, props *KubeNamespaceListProps) KubeNamespaceList { + _init_.Initialize() + + if err := validateNewKubeNamespaceListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeNamespaceList{} + + _jsii_.Create( + "k8s.KubeNamespaceList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.NamespaceList" API object. +func NewKubeNamespaceList_Override(k KubeNamespaceList, scope constructs.Construct, id *string, props *KubeNamespaceListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeNamespaceList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeNamespaceList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNamespaceList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNamespaceList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeNamespaceList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNamespaceList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNamespaceList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.NamespaceList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeNamespaceList_Manifest(props *KubeNamespaceListProps) interface{} { + _init_.Initialize() + + if err := validateKubeNamespaceList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeNamespaceList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeNamespaceList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeNamespaceList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeNamespaceList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeNamespaceList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeNamespaceList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeNamespaceList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeNamespaceList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeNamespaceList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeNamespaceList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceListProps.go new file mode 100644 index 0000000..0c765df --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// NamespaceList is a list of Namespaces. +type KubeNamespaceListProps struct { + // Items is the list of Namespace objects in the list. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + Items *[]*KubeNamespaceProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceList__checks.go new file mode 100644 index 0000000..05dec14 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeNamespaceList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeNamespaceList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeNamespaceList_ManifestParameters(props *KubeNamespaceListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeNamespaceList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeNamespaceListParameters(scope constructs.Construct, id *string, props *KubeNamespaceListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceList__no_checks.go new file mode 100644 index 0000000..b1a2c99 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeNamespaceList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeNamespaceList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeNamespaceList_ManifestParameters(props *KubeNamespaceListProps) error { + return nil +} + +func validateKubeNamespaceList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeNamespaceListParameters(scope constructs.Construct, id *string, props *KubeNamespaceListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceProps.go new file mode 100644 index 0000000..14fbd94 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespaceProps.go @@ -0,0 +1,17 @@ +package k8s + + +// Namespace provides a scope for Names. +// +// Use of multiple namespaces is optional. +type KubeNamespaceProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec defines the behavior of the Namespace. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *NamespaceSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespace__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespace__checks.go new file mode 100644 index 0000000..84c3e60 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespace__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeNamespace_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeNamespace_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeNamespace_ManifestParameters(props *KubeNamespaceProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeNamespace_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeNamespaceParameters(scope constructs.Construct, id *string, props *KubeNamespaceProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespace__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespace__no_checks.go new file mode 100644 index 0000000..3483e14 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNamespace__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeNamespace_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeNamespace_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeNamespace_ManifestParameters(props *KubeNamespaceProps) error { + return nil +} + +func validateKubeNamespace_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeNamespaceParameters(scope constructs.Construct, id *string, props *KubeNamespaceProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicy.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicy.go new file mode 100644 index 0000000..e19afb6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicy.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// NetworkPolicy describes what network traffic is allowed for a set of Pods. +type KubeNetworkPolicy interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeNetworkPolicy +type jsiiProxy_KubeNetworkPolicy struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeNetworkPolicy) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicy) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicy) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicy) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicy) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicy) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicy) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.networking.v1.NetworkPolicy" API object. +func NewKubeNetworkPolicy(scope constructs.Construct, id *string, props *KubeNetworkPolicyProps) KubeNetworkPolicy { + _init_.Initialize() + + if err := validateNewKubeNetworkPolicyParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeNetworkPolicy{} + + _jsii_.Create( + "k8s.KubeNetworkPolicy", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.networking.v1.NetworkPolicy" API object. +func NewKubeNetworkPolicy_Override(k KubeNetworkPolicy, scope constructs.Construct, id *string, props *KubeNetworkPolicyProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeNetworkPolicy", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeNetworkPolicy_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNetworkPolicy_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNetworkPolicy", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeNetworkPolicy_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNetworkPolicy_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNetworkPolicy", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.networking.v1.NetworkPolicy". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeNetworkPolicy_Manifest(props *KubeNetworkPolicyProps) interface{} { + _init_.Initialize() + + if err := validateKubeNetworkPolicy_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeNetworkPolicy", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeNetworkPolicy_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeNetworkPolicy_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeNetworkPolicy", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeNetworkPolicy_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeNetworkPolicy", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeNetworkPolicy) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeNetworkPolicy) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeNetworkPolicy) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeNetworkPolicy) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyList.go new file mode 100644 index 0000000..6887cf8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// NetworkPolicyList is a list of NetworkPolicy objects. +type KubeNetworkPolicyList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeNetworkPolicyList +type jsiiProxy_KubeNetworkPolicyList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeNetworkPolicyList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicyList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicyList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicyList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicyList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicyList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNetworkPolicyList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.networking.v1.NetworkPolicyList" API object. +func NewKubeNetworkPolicyList(scope constructs.Construct, id *string, props *KubeNetworkPolicyListProps) KubeNetworkPolicyList { + _init_.Initialize() + + if err := validateNewKubeNetworkPolicyListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeNetworkPolicyList{} + + _jsii_.Create( + "k8s.KubeNetworkPolicyList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.networking.v1.NetworkPolicyList" API object. +func NewKubeNetworkPolicyList_Override(k KubeNetworkPolicyList, scope constructs.Construct, id *string, props *KubeNetworkPolicyListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeNetworkPolicyList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeNetworkPolicyList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNetworkPolicyList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNetworkPolicyList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeNetworkPolicyList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNetworkPolicyList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNetworkPolicyList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.networking.v1.NetworkPolicyList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeNetworkPolicyList_Manifest(props *KubeNetworkPolicyListProps) interface{} { + _init_.Initialize() + + if err := validateKubeNetworkPolicyList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeNetworkPolicyList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeNetworkPolicyList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeNetworkPolicyList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeNetworkPolicyList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeNetworkPolicyList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeNetworkPolicyList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeNetworkPolicyList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeNetworkPolicyList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeNetworkPolicyList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeNetworkPolicyList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyListProps.go new file mode 100644 index 0000000..0ed8303 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// NetworkPolicyList is a list of NetworkPolicy objects. +type KubeNetworkPolicyListProps struct { + // Items is a list of schema objects. + Items *[]*KubeNetworkPolicyProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyList__checks.go new file mode 100644 index 0000000..d08fcfc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeNetworkPolicyList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeNetworkPolicyList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeNetworkPolicyList_ManifestParameters(props *KubeNetworkPolicyListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeNetworkPolicyList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeNetworkPolicyListParameters(scope constructs.Construct, id *string, props *KubeNetworkPolicyListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyList__no_checks.go new file mode 100644 index 0000000..2543578 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeNetworkPolicyList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeNetworkPolicyList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeNetworkPolicyList_ManifestParameters(props *KubeNetworkPolicyListProps) error { + return nil +} + +func validateKubeNetworkPolicyList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeNetworkPolicyListParameters(scope constructs.Construct, id *string, props *KubeNetworkPolicyListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyProps.go new file mode 100644 index 0000000..f9f2d73 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicyProps.go @@ -0,0 +1,13 @@ +package k8s + + +// NetworkPolicy describes what network traffic is allowed for a set of Pods. +type KubeNetworkPolicyProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Specification of the desired behavior for this NetworkPolicy. + Spec *NetworkPolicySpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicy__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicy__checks.go new file mode 100644 index 0000000..a8a8eda --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicy__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeNetworkPolicy_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeNetworkPolicy_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeNetworkPolicy_ManifestParameters(props *KubeNetworkPolicyProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeNetworkPolicy_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeNetworkPolicyParameters(scope constructs.Construct, id *string, props *KubeNetworkPolicyProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicy__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicy__no_checks.go new file mode 100644 index 0000000..6693b20 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNetworkPolicy__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeNetworkPolicy_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeNetworkPolicy_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeNetworkPolicy_ManifestParameters(props *KubeNetworkPolicyProps) error { + return nil +} + +func validateKubeNetworkPolicy_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeNetworkPolicyParameters(scope constructs.Construct, id *string, props *KubeNetworkPolicyProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNode.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNode.go new file mode 100644 index 0000000..e7d305c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNode.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Node is a worker node in Kubernetes. +// +// Each node will have a unique identifier in the cache (i.e. in etcd). +type KubeNode interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeNode +type jsiiProxy_KubeNode struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeNode) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNode) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNode) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNode) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNode) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNode) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNode) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.Node" API object. +func NewKubeNode(scope constructs.Construct, id *string, props *KubeNodeProps) KubeNode { + _init_.Initialize() + + if err := validateNewKubeNodeParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeNode{} + + _jsii_.Create( + "k8s.KubeNode", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.Node" API object. +func NewKubeNode_Override(k KubeNode, scope constructs.Construct, id *string, props *KubeNodeProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeNode", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeNode_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNode_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNode", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeNode_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNode_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNode", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.Node". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeNode_Manifest(props *KubeNodeProps) interface{} { + _init_.Initialize() + + if err := validateKubeNode_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeNode", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeNode_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeNode_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeNode", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeNode_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeNode", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeNode) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeNode) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeNode) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeNode) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeList.go new file mode 100644 index 0000000..cd61044 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// NodeList is the whole list of all Nodes which have been registered with master. +type KubeNodeList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeNodeList +type jsiiProxy_KubeNodeList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeNodeList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNodeList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNodeList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNodeList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNodeList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNodeList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeNodeList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.NodeList" API object. +func NewKubeNodeList(scope constructs.Construct, id *string, props *KubeNodeListProps) KubeNodeList { + _init_.Initialize() + + if err := validateNewKubeNodeListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeNodeList{} + + _jsii_.Create( + "k8s.KubeNodeList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.NodeList" API object. +func NewKubeNodeList_Override(k KubeNodeList, scope constructs.Construct, id *string, props *KubeNodeListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeNodeList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeNodeList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNodeList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNodeList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeNodeList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeNodeList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeNodeList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.NodeList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeNodeList_Manifest(props *KubeNodeListProps) interface{} { + _init_.Initialize() + + if err := validateKubeNodeList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeNodeList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeNodeList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeNodeList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeNodeList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeNodeList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeNodeList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeNodeList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeNodeList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeNodeList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeNodeList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeListProps.go new file mode 100644 index 0000000..ad657bd --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// NodeList is the whole list of all Nodes which have been registered with master. +type KubeNodeListProps struct { + // List of nodes. + Items *[]*KubeNodeProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeList__checks.go new file mode 100644 index 0000000..94e4fac --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeNodeList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeNodeList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeNodeList_ManifestParameters(props *KubeNodeListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeNodeList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeNodeListParameters(scope constructs.Construct, id *string, props *KubeNodeListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeList__no_checks.go new file mode 100644 index 0000000..bd785c4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeNodeList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeNodeList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeNodeList_ManifestParameters(props *KubeNodeListProps) error { + return nil +} + +func validateKubeNodeList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeNodeListParameters(scope constructs.Construct, id *string, props *KubeNodeListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeProps.go new file mode 100644 index 0000000..707d5f5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNodeProps.go @@ -0,0 +1,17 @@ +package k8s + + +// Node is a worker node in Kubernetes. +// +// Each node will have a unique identifier in the cache (i.e. in etcd). +type KubeNodeProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec defines the behavior of a node. + // + // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *NodeSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNode__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNode__checks.go new file mode 100644 index 0000000..d1ad268 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNode__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeNode_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeNode_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeNode_ManifestParameters(props *KubeNodeProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeNode_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeNodeParameters(scope constructs.Construct, id *string, props *KubeNodeProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeNode__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeNode__no_checks.go new file mode 100644 index 0000000..09e22a7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeNode__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeNode_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeNode_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeNode_ManifestParameters(props *KubeNodeProps) error { + return nil +} + +func validateKubeNode_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeNodeParameters(scope constructs.Construct, id *string, props *KubeNodeProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolume.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolume.go new file mode 100644 index 0000000..60ada2f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolume.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PersistentVolume (PV) is a storage resource provisioned by an administrator. +// +// It is analogous to a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes +type KubePersistentVolume interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePersistentVolume +type jsiiProxy_KubePersistentVolume struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePersistentVolume) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolume) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolume) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolume) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolume) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolume) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolume) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.PersistentVolume" API object. +func NewKubePersistentVolume(scope constructs.Construct, id *string, props *KubePersistentVolumeProps) KubePersistentVolume { + _init_.Initialize() + + if err := validateNewKubePersistentVolumeParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePersistentVolume{} + + _jsii_.Create( + "k8s.KubePersistentVolume", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.PersistentVolume" API object. +func NewKubePersistentVolume_Override(k KubePersistentVolume, scope constructs.Construct, id *string, props *KubePersistentVolumeProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePersistentVolume", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePersistentVolume_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePersistentVolume_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolume", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePersistentVolume_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePersistentVolume_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolume", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.PersistentVolume". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePersistentVolume_Manifest(props *KubePersistentVolumeProps) interface{} { + _init_.Initialize() + + if err := validateKubePersistentVolume_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolume", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePersistentVolume_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePersistentVolume_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolume", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePersistentVolume_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePersistentVolume", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePersistentVolume) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePersistentVolume) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePersistentVolume) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePersistentVolume) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaim.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaim.go new file mode 100644 index 0000000..3b7f626 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaim.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PersistentVolumeClaim is a user's request for and claim to a persistent volume. +type KubePersistentVolumeClaim interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePersistentVolumeClaim +type jsiiProxy_KubePersistentVolumeClaim struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePersistentVolumeClaim) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaim) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaim) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaim) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaim) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaim) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaim) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.PersistentVolumeClaim" API object. +func NewKubePersistentVolumeClaim(scope constructs.Construct, id *string, props *KubePersistentVolumeClaimProps) KubePersistentVolumeClaim { + _init_.Initialize() + + if err := validateNewKubePersistentVolumeClaimParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePersistentVolumeClaim{} + + _jsii_.Create( + "k8s.KubePersistentVolumeClaim", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.PersistentVolumeClaim" API object. +func NewKubePersistentVolumeClaim_Override(k KubePersistentVolumeClaim, scope constructs.Construct, id *string, props *KubePersistentVolumeClaimProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePersistentVolumeClaim", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePersistentVolumeClaim_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePersistentVolumeClaim_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeClaim", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePersistentVolumeClaim_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePersistentVolumeClaim_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeClaim", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.PersistentVolumeClaim". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePersistentVolumeClaim_Manifest(props *KubePersistentVolumeClaimProps) interface{} { + _init_.Initialize() + + if err := validateKubePersistentVolumeClaim_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeClaim", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePersistentVolumeClaim_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePersistentVolumeClaim_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeClaim", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePersistentVolumeClaim_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePersistentVolumeClaim", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePersistentVolumeClaim) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePersistentVolumeClaim) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePersistentVolumeClaim) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePersistentVolumeClaim) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimList.go new file mode 100644 index 0000000..e70bb7a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PersistentVolumeClaimList is a list of PersistentVolumeClaim items. +type KubePersistentVolumeClaimList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePersistentVolumeClaimList +type jsiiProxy_KubePersistentVolumeClaimList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePersistentVolumeClaimList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaimList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaimList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaimList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaimList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaimList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeClaimList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.PersistentVolumeClaimList" API object. +func NewKubePersistentVolumeClaimList(scope constructs.Construct, id *string, props *KubePersistentVolumeClaimListProps) KubePersistentVolumeClaimList { + _init_.Initialize() + + if err := validateNewKubePersistentVolumeClaimListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePersistentVolumeClaimList{} + + _jsii_.Create( + "k8s.KubePersistentVolumeClaimList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.PersistentVolumeClaimList" API object. +func NewKubePersistentVolumeClaimList_Override(k KubePersistentVolumeClaimList, scope constructs.Construct, id *string, props *KubePersistentVolumeClaimListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePersistentVolumeClaimList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePersistentVolumeClaimList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePersistentVolumeClaimList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeClaimList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePersistentVolumeClaimList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePersistentVolumeClaimList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeClaimList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.PersistentVolumeClaimList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePersistentVolumeClaimList_Manifest(props *KubePersistentVolumeClaimListProps) interface{} { + _init_.Initialize() + + if err := validateKubePersistentVolumeClaimList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeClaimList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePersistentVolumeClaimList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePersistentVolumeClaimList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeClaimList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePersistentVolumeClaimList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePersistentVolumeClaimList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePersistentVolumeClaimList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePersistentVolumeClaimList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePersistentVolumeClaimList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePersistentVolumeClaimList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimListProps.go new file mode 100644 index 0000000..dd685a1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// PersistentVolumeClaimList is a list of PersistentVolumeClaim items. +type KubePersistentVolumeClaimListProps struct { + // items is a list of persistent volume claims. + // + // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + Items *[]*KubePersistentVolumeClaimProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimList__checks.go new file mode 100644 index 0000000..5ff8dcf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePersistentVolumeClaimList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePersistentVolumeClaimList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePersistentVolumeClaimList_ManifestParameters(props *KubePersistentVolumeClaimListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePersistentVolumeClaimList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePersistentVolumeClaimListParameters(scope constructs.Construct, id *string, props *KubePersistentVolumeClaimListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimList__no_checks.go new file mode 100644 index 0000000..e7dfc66 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePersistentVolumeClaimList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePersistentVolumeClaimList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePersistentVolumeClaimList_ManifestParameters(props *KubePersistentVolumeClaimListProps) error { + return nil +} + +func validateKubePersistentVolumeClaimList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePersistentVolumeClaimListParameters(scope constructs.Construct, id *string, props *KubePersistentVolumeClaimListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimProps.go new file mode 100644 index 0000000..861f51d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaimProps.go @@ -0,0 +1,15 @@ +package k8s + + +// PersistentVolumeClaim is a user's request for and claim to a persistent volume. +type KubePersistentVolumeClaimProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // spec defines the desired characteristics of a volume requested by a pod author. + // + // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + Spec *PersistentVolumeClaimSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaim__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaim__checks.go new file mode 100644 index 0000000..7d69840 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaim__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePersistentVolumeClaim_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePersistentVolumeClaim_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePersistentVolumeClaim_ManifestParameters(props *KubePersistentVolumeClaimProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePersistentVolumeClaim_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePersistentVolumeClaimParameters(scope constructs.Construct, id *string, props *KubePersistentVolumeClaimProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaim__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaim__no_checks.go new file mode 100644 index 0000000..b480d50 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeClaim__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePersistentVolumeClaim_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePersistentVolumeClaim_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePersistentVolumeClaim_ManifestParameters(props *KubePersistentVolumeClaimProps) error { + return nil +} + +func validateKubePersistentVolumeClaim_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePersistentVolumeClaimParameters(scope constructs.Construct, id *string, props *KubePersistentVolumeClaimProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeList.go new file mode 100644 index 0000000..c5d174f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PersistentVolumeList is a list of PersistentVolume items. +type KubePersistentVolumeList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePersistentVolumeList +type jsiiProxy_KubePersistentVolumeList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePersistentVolumeList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePersistentVolumeList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.PersistentVolumeList" API object. +func NewKubePersistentVolumeList(scope constructs.Construct, id *string, props *KubePersistentVolumeListProps) KubePersistentVolumeList { + _init_.Initialize() + + if err := validateNewKubePersistentVolumeListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePersistentVolumeList{} + + _jsii_.Create( + "k8s.KubePersistentVolumeList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.PersistentVolumeList" API object. +func NewKubePersistentVolumeList_Override(k KubePersistentVolumeList, scope constructs.Construct, id *string, props *KubePersistentVolumeListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePersistentVolumeList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePersistentVolumeList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePersistentVolumeList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePersistentVolumeList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePersistentVolumeList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.PersistentVolumeList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePersistentVolumeList_Manifest(props *KubePersistentVolumeListProps) interface{} { + _init_.Initialize() + + if err := validateKubePersistentVolumeList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePersistentVolumeList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePersistentVolumeList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePersistentVolumeList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePersistentVolumeList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePersistentVolumeList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePersistentVolumeList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePersistentVolumeList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePersistentVolumeList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePersistentVolumeList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeListProps.go new file mode 100644 index 0000000..4596fb3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// PersistentVolumeList is a list of PersistentVolume items. +type KubePersistentVolumeListProps struct { + // items is a list of persistent volumes. + // + // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes + Items *[]*KubePersistentVolumeProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeList__checks.go new file mode 100644 index 0000000..f361133 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePersistentVolumeList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePersistentVolumeList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePersistentVolumeList_ManifestParameters(props *KubePersistentVolumeListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePersistentVolumeList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePersistentVolumeListParameters(scope constructs.Construct, id *string, props *KubePersistentVolumeListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeList__no_checks.go new file mode 100644 index 0000000..9f04c34 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePersistentVolumeList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePersistentVolumeList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePersistentVolumeList_ManifestParameters(props *KubePersistentVolumeListProps) error { + return nil +} + +func validateKubePersistentVolumeList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePersistentVolumeListParameters(scope constructs.Construct, id *string, props *KubePersistentVolumeListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeProps.go new file mode 100644 index 0000000..bd8e608 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolumeProps.go @@ -0,0 +1,17 @@ +package k8s + + +// PersistentVolume (PV) is a storage resource provisioned by an administrator. +// +// It is analogous to a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes +type KubePersistentVolumeProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // spec defines a specification of a persistent volume owned by the cluster. + // + // Provisioned by an administrator. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes + Spec *PersistentVolumeSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolume__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolume__checks.go new file mode 100644 index 0000000..8aef631 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolume__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePersistentVolume_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePersistentVolume_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePersistentVolume_ManifestParameters(props *KubePersistentVolumeProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePersistentVolume_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePersistentVolumeParameters(scope constructs.Construct, id *string, props *KubePersistentVolumeProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolume__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolume__no_checks.go new file mode 100644 index 0000000..bfc59d9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePersistentVolume__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePersistentVolume_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePersistentVolume_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePersistentVolume_ManifestParameters(props *KubePersistentVolumeProps) error { + return nil +} + +func validateKubePersistentVolume_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePersistentVolumeParameters(scope constructs.Construct, id *string, props *KubePersistentVolumeProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePod.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePod.go new file mode 100644 index 0000000..f5bca76 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePod.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Pod is a collection of containers that can run on a host. +// +// This resource is created by clients and scheduled onto hosts. +type KubePod interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePod +type jsiiProxy_KubePod struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePod) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePod) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePod) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePod) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePod) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePod) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePod) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.Pod" API object. +func NewKubePod(scope constructs.Construct, id *string, props *KubePodProps) KubePod { + _init_.Initialize() + + if err := validateNewKubePodParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePod{} + + _jsii_.Create( + "k8s.KubePod", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.Pod" API object. +func NewKubePod_Override(k KubePod, scope constructs.Construct, id *string, props *KubePodProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePod", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePod_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePod_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePod", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePod_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePod_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePod", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.Pod". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePod_Manifest(props *KubePodProps) interface{} { + _init_.Initialize() + + if err := validateKubePod_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePod", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePod_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePod_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePod", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePod_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePod", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePod) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePod) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePod) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePod) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudget.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudget.go new file mode 100644 index 0000000..a006cc2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudget.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods. +type KubePodDisruptionBudget interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePodDisruptionBudget +type jsiiProxy_KubePodDisruptionBudget struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePodDisruptionBudget) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudget) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudget) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudget) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudget) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudget) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudget) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.policy.v1.PodDisruptionBudget" API object. +func NewKubePodDisruptionBudget(scope constructs.Construct, id *string, props *KubePodDisruptionBudgetProps) KubePodDisruptionBudget { + _init_.Initialize() + + if err := validateNewKubePodDisruptionBudgetParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePodDisruptionBudget{} + + _jsii_.Create( + "k8s.KubePodDisruptionBudget", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.policy.v1.PodDisruptionBudget" API object. +func NewKubePodDisruptionBudget_Override(k KubePodDisruptionBudget, scope constructs.Construct, id *string, props *KubePodDisruptionBudgetProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePodDisruptionBudget", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePodDisruptionBudget_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePodDisruptionBudget_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePodDisruptionBudget", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePodDisruptionBudget_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePodDisruptionBudget_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePodDisruptionBudget", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.policy.v1.PodDisruptionBudget". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePodDisruptionBudget_Manifest(props *KubePodDisruptionBudgetProps) interface{} { + _init_.Initialize() + + if err := validateKubePodDisruptionBudget_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePodDisruptionBudget", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePodDisruptionBudget_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePodDisruptionBudget_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePodDisruptionBudget", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePodDisruptionBudget_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePodDisruptionBudget", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePodDisruptionBudget) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePodDisruptionBudget) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePodDisruptionBudget) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePodDisruptionBudget) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetList.go new file mode 100644 index 0000000..e85c5fe --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PodDisruptionBudgetList is a collection of PodDisruptionBudgets. +type KubePodDisruptionBudgetList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePodDisruptionBudgetList +type jsiiProxy_KubePodDisruptionBudgetList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePodDisruptionBudgetList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudgetList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudgetList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudgetList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudgetList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudgetList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodDisruptionBudgetList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.policy.v1.PodDisruptionBudgetList" API object. +func NewKubePodDisruptionBudgetList(scope constructs.Construct, id *string, props *KubePodDisruptionBudgetListProps) KubePodDisruptionBudgetList { + _init_.Initialize() + + if err := validateNewKubePodDisruptionBudgetListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePodDisruptionBudgetList{} + + _jsii_.Create( + "k8s.KubePodDisruptionBudgetList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.policy.v1.PodDisruptionBudgetList" API object. +func NewKubePodDisruptionBudgetList_Override(k KubePodDisruptionBudgetList, scope constructs.Construct, id *string, props *KubePodDisruptionBudgetListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePodDisruptionBudgetList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePodDisruptionBudgetList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePodDisruptionBudgetList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePodDisruptionBudgetList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePodDisruptionBudgetList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePodDisruptionBudgetList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePodDisruptionBudgetList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.policy.v1.PodDisruptionBudgetList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePodDisruptionBudgetList_Manifest(props *KubePodDisruptionBudgetListProps) interface{} { + _init_.Initialize() + + if err := validateKubePodDisruptionBudgetList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePodDisruptionBudgetList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePodDisruptionBudgetList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePodDisruptionBudgetList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePodDisruptionBudgetList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePodDisruptionBudgetList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePodDisruptionBudgetList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePodDisruptionBudgetList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePodDisruptionBudgetList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePodDisruptionBudgetList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePodDisruptionBudgetList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetListProps.go new file mode 100644 index 0000000..c0030f5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// PodDisruptionBudgetList is a collection of PodDisruptionBudgets. +type KubePodDisruptionBudgetListProps struct { + // Items is a list of PodDisruptionBudgets. + Items *[]*KubePodDisruptionBudgetProps `field:"required" json:"items" yaml:"items"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetList__checks.go new file mode 100644 index 0000000..92ee0cb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePodDisruptionBudgetList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePodDisruptionBudgetList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePodDisruptionBudgetList_ManifestParameters(props *KubePodDisruptionBudgetListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePodDisruptionBudgetList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePodDisruptionBudgetListParameters(scope constructs.Construct, id *string, props *KubePodDisruptionBudgetListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetList__no_checks.go new file mode 100644 index 0000000..61e1865 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePodDisruptionBudgetList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePodDisruptionBudgetList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePodDisruptionBudgetList_ManifestParameters(props *KubePodDisruptionBudgetListProps) error { + return nil +} + +func validateKubePodDisruptionBudgetList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePodDisruptionBudgetListParameters(scope constructs.Construct, id *string, props *KubePodDisruptionBudgetListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetProps.go new file mode 100644 index 0000000..13ee18b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudgetProps.go @@ -0,0 +1,13 @@ +package k8s + + +// PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods. +type KubePodDisruptionBudgetProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Specification of the desired behavior of the PodDisruptionBudget. + Spec *PodDisruptionBudgetSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudget__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudget__checks.go new file mode 100644 index 0000000..4839e96 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudget__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePodDisruptionBudget_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePodDisruptionBudget_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePodDisruptionBudget_ManifestParameters(props *KubePodDisruptionBudgetProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePodDisruptionBudget_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePodDisruptionBudgetParameters(scope constructs.Construct, id *string, props *KubePodDisruptionBudgetProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudget__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudget__no_checks.go new file mode 100644 index 0000000..e412aae --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodDisruptionBudget__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePodDisruptionBudget_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePodDisruptionBudget_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePodDisruptionBudget_ManifestParameters(props *KubePodDisruptionBudgetProps) error { + return nil +} + +func validateKubePodDisruptionBudget_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePodDisruptionBudgetParameters(scope constructs.Construct, id *string, props *KubePodDisruptionBudgetProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodList.go new file mode 100644 index 0000000..96e214c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PodList is a list of Pods. +type KubePodList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePodList +type jsiiProxy_KubePodList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePodList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.PodList" API object. +func NewKubePodList(scope constructs.Construct, id *string, props *KubePodListProps) KubePodList { + _init_.Initialize() + + if err := validateNewKubePodListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePodList{} + + _jsii_.Create( + "k8s.KubePodList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.PodList" API object. +func NewKubePodList_Override(k KubePodList, scope constructs.Construct, id *string, props *KubePodListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePodList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePodList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePodList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePodList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePodList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePodList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePodList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.PodList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePodList_Manifest(props *KubePodListProps) interface{} { + _init_.Initialize() + + if err := validateKubePodList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePodList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePodList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePodList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePodList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePodList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePodList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePodList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePodList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePodList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePodList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodListProps.go new file mode 100644 index 0000000..9a46169 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// PodList is a list of Pods. +type KubePodListProps struct { + // List of pods. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md + Items *[]*KubePodProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodList__checks.go new file mode 100644 index 0000000..6524a0b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePodList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePodList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePodList_ManifestParameters(props *KubePodListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePodList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePodListParameters(scope constructs.Construct, id *string, props *KubePodListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodList__no_checks.go new file mode 100644 index 0000000..dd0e9a2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePodList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePodList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePodList_ManifestParameters(props *KubePodListProps) error { + return nil +} + +func validateKubePodList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePodListParameters(scope constructs.Construct, id *string, props *KubePodListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodProps.go new file mode 100644 index 0000000..4ebec53 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodProps.go @@ -0,0 +1,17 @@ +package k8s + + +// Pod is a collection of containers that can run on a host. +// +// This resource is created by clients and scheduled onto hosts. +type KubePodProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Specification of the desired behavior of the pod. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *PodSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplate.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplate.go new file mode 100644 index 0000000..76a2f40 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplate.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PodTemplate describes a template for creating copies of a predefined pod. +type KubePodTemplate interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePodTemplate +type jsiiProxy_KubePodTemplate struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePodTemplate) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplate) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplate) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplate) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplate) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplate) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplate) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.PodTemplate" API object. +func NewKubePodTemplate(scope constructs.Construct, id *string, props *KubePodTemplateProps) KubePodTemplate { + _init_.Initialize() + + if err := validateNewKubePodTemplateParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePodTemplate{} + + _jsii_.Create( + "k8s.KubePodTemplate", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.PodTemplate" API object. +func NewKubePodTemplate_Override(k KubePodTemplate, scope constructs.Construct, id *string, props *KubePodTemplateProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePodTemplate", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePodTemplate_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePodTemplate_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePodTemplate", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePodTemplate_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePodTemplate_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePodTemplate", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.PodTemplate". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePodTemplate_Manifest(props *KubePodTemplateProps) interface{} { + _init_.Initialize() + + if err := validateKubePodTemplate_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePodTemplate", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePodTemplate_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePodTemplate_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePodTemplate", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePodTemplate_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePodTemplate", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePodTemplate) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePodTemplate) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePodTemplate) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePodTemplate) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateList.go new file mode 100644 index 0000000..6f6aa81 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PodTemplateList is a list of PodTemplates. +type KubePodTemplateList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePodTemplateList +type jsiiProxy_KubePodTemplateList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePodTemplateList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplateList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplateList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplateList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplateList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplateList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePodTemplateList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.PodTemplateList" API object. +func NewKubePodTemplateList(scope constructs.Construct, id *string, props *KubePodTemplateListProps) KubePodTemplateList { + _init_.Initialize() + + if err := validateNewKubePodTemplateListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePodTemplateList{} + + _jsii_.Create( + "k8s.KubePodTemplateList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.PodTemplateList" API object. +func NewKubePodTemplateList_Override(k KubePodTemplateList, scope constructs.Construct, id *string, props *KubePodTemplateListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePodTemplateList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePodTemplateList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePodTemplateList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePodTemplateList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePodTemplateList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePodTemplateList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePodTemplateList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.PodTemplateList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePodTemplateList_Manifest(props *KubePodTemplateListProps) interface{} { + _init_.Initialize() + + if err := validateKubePodTemplateList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePodTemplateList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePodTemplateList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePodTemplateList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePodTemplateList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePodTemplateList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePodTemplateList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePodTemplateList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePodTemplateList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePodTemplateList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePodTemplateList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateListProps.go new file mode 100644 index 0000000..3b6da55 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// PodTemplateList is a list of PodTemplates. +type KubePodTemplateListProps struct { + // List of pod templates. + Items *[]*KubePodTemplateProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateList__checks.go new file mode 100644 index 0000000..d9c4a06 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePodTemplateList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePodTemplateList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePodTemplateList_ManifestParameters(props *KubePodTemplateListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePodTemplateList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePodTemplateListParameters(scope constructs.Construct, id *string, props *KubePodTemplateListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateList__no_checks.go new file mode 100644 index 0000000..5e4d028 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePodTemplateList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePodTemplateList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePodTemplateList_ManifestParameters(props *KubePodTemplateListProps) error { + return nil +} + +func validateKubePodTemplateList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePodTemplateListParameters(scope constructs.Construct, id *string, props *KubePodTemplateListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateProps.go new file mode 100644 index 0000000..772308a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplateProps.go @@ -0,0 +1,15 @@ +package k8s + + +// PodTemplate describes a template for creating copies of a predefined pod. +type KubePodTemplateProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Template defines the pods that will be created from this pod template. + // + // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Template *PodTemplateSpec `field:"optional" json:"template" yaml:"template"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplate__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplate__checks.go new file mode 100644 index 0000000..483487b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplate__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePodTemplate_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePodTemplate_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePodTemplate_ManifestParameters(props *KubePodTemplateProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePodTemplate_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePodTemplateParameters(scope constructs.Construct, id *string, props *KubePodTemplateProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplate__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplate__no_checks.go new file mode 100644 index 0000000..c436668 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePodTemplate__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePodTemplate_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePodTemplate_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePodTemplate_ManifestParameters(props *KubePodTemplateProps) error { + return nil +} + +func validateKubePodTemplate_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePodTemplateParameters(scope constructs.Construct, id *string, props *KubePodTemplateProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePod__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePod__checks.go new file mode 100644 index 0000000..9714490 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePod__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePod_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePod_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePod_ManifestParameters(props *KubePodProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePod_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePodParameters(scope constructs.Construct, id *string, props *KubePodProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePod__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePod__no_checks.go new file mode 100644 index 0000000..5f55f5f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePod__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePod_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePod_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePod_ManifestParameters(props *KubePodProps) error { + return nil +} + +func validateKubePod_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePodParameters(scope constructs.Construct, id *string, props *KubePodProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClass.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClass.go new file mode 100644 index 0000000..4208eec --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClass.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PriorityClass defines mapping from a priority class name to the priority integer value. +// +// The value can be any valid integer. +type KubePriorityClass interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePriorityClass +type jsiiProxy_KubePriorityClass struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePriorityClass) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClass) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClass) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClass) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClass) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClass) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClass) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.scheduling.v1.PriorityClass" API object. +func NewKubePriorityClass(scope constructs.Construct, id *string, props *KubePriorityClassProps) KubePriorityClass { + _init_.Initialize() + + if err := validateNewKubePriorityClassParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePriorityClass{} + + _jsii_.Create( + "k8s.KubePriorityClass", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.scheduling.v1.PriorityClass" API object. +func NewKubePriorityClass_Override(k KubePriorityClass, scope constructs.Construct, id *string, props *KubePriorityClassProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePriorityClass", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePriorityClass_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityClass_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityClass", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePriorityClass_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityClass_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityClass", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.scheduling.v1.PriorityClass". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePriorityClass_Manifest(props *KubePriorityClassProps) interface{} { + _init_.Initialize() + + if err := validateKubePriorityClass_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePriorityClass", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePriorityClass_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePriorityClass_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePriorityClass", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePriorityClass_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePriorityClass", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePriorityClass) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePriorityClass) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePriorityClass) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePriorityClass) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassList.go new file mode 100644 index 0000000..0a094e8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PriorityClassList is a collection of priority classes. +type KubePriorityClassList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePriorityClassList +type jsiiProxy_KubePriorityClassList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePriorityClassList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClassList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClassList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClassList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClassList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClassList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityClassList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.scheduling.v1.PriorityClassList" API object. +func NewKubePriorityClassList(scope constructs.Construct, id *string, props *KubePriorityClassListProps) KubePriorityClassList { + _init_.Initialize() + + if err := validateNewKubePriorityClassListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePriorityClassList{} + + _jsii_.Create( + "k8s.KubePriorityClassList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.scheduling.v1.PriorityClassList" API object. +func NewKubePriorityClassList_Override(k KubePriorityClassList, scope constructs.Construct, id *string, props *KubePriorityClassListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePriorityClassList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePriorityClassList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityClassList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityClassList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePriorityClassList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityClassList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityClassList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.scheduling.v1.PriorityClassList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePriorityClassList_Manifest(props *KubePriorityClassListProps) interface{} { + _init_.Initialize() + + if err := validateKubePriorityClassList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePriorityClassList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePriorityClassList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePriorityClassList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePriorityClassList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePriorityClassList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePriorityClassList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePriorityClassList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePriorityClassList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePriorityClassList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePriorityClassList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassListProps.go new file mode 100644 index 0000000..7f017a5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// PriorityClassList is a collection of priority classes. +type KubePriorityClassListProps struct { + // items is the list of PriorityClasses. + Items *[]*KubePriorityClassProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassList__checks.go new file mode 100644 index 0000000..3127fee --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePriorityClassList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityClassList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityClassList_ManifestParameters(props *KubePriorityClassListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePriorityClassList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePriorityClassListParameters(scope constructs.Construct, id *string, props *KubePriorityClassListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassList__no_checks.go new file mode 100644 index 0000000..241fb9c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePriorityClassList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePriorityClassList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePriorityClassList_ManifestParameters(props *KubePriorityClassListProps) error { + return nil +} + +func validateKubePriorityClassList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePriorityClassListParameters(scope constructs.Construct, id *string, props *KubePriorityClassListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassProps.go new file mode 100644 index 0000000..aac3120 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClassProps.go @@ -0,0 +1,29 @@ +package k8s + + +// PriorityClass defines mapping from a priority class name to the priority integer value. +// +// The value can be any valid integer. +type KubePriorityClassProps struct { + // The value of this priority class. + // + // This is the actual priority that pods receive when they have the name of this class in their pod spec. + Value *float64 `field:"required" json:"value" yaml:"value"` + // description is an arbitrary string that usually provides guidelines on when this priority class should be used. + Description *string `field:"optional" json:"description" yaml:"description"` + // globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. + // + // Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority. + GlobalDefault *bool `field:"optional" json:"globalDefault" yaml:"globalDefault"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // PreemptionPolicy is the Policy for preempting pods with lower priority. + // + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // Default: PreemptLowerPriority if unset. + // + PreemptionPolicy *string `field:"optional" json:"preemptionPolicy" yaml:"preemptionPolicy"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClass__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClass__checks.go new file mode 100644 index 0000000..55b8128 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClass__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePriorityClass_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityClass_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityClass_ManifestParameters(props *KubePriorityClassProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePriorityClass_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePriorityClassParameters(scope constructs.Construct, id *string, props *KubePriorityClassProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClass__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClass__no_checks.go new file mode 100644 index 0000000..7897f67 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityClass__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePriorityClass_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePriorityClass_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePriorityClass_ManifestParameters(props *KubePriorityClassProps) error { + return nil +} + +func validateKubePriorityClass_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePriorityClassParameters(scope constructs.Construct, id *string, props *KubePriorityClassProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1.go new file mode 100644 index 0000000..cd18317 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects. +type KubePriorityLevelConfigurationListV1Beta1 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePriorityLevelConfigurationListV1Beta1 +type jsiiProxy_KubePriorityLevelConfigurationListV1Beta1 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.flowcontrol.v1beta1.PriorityLevelConfigurationList" API object. +func NewKubePriorityLevelConfigurationListV1Beta1(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationListV1Beta1Props) KubePriorityLevelConfigurationListV1Beta1 { + _init_.Initialize() + + if err := validateNewKubePriorityLevelConfigurationListV1Beta1Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePriorityLevelConfigurationListV1Beta1{} + + _jsii_.Create( + "k8s.KubePriorityLevelConfigurationListV1Beta1", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.flowcontrol.v1beta1.PriorityLevelConfigurationList" API object. +func NewKubePriorityLevelConfigurationListV1Beta1_Override(k KubePriorityLevelConfigurationListV1Beta1, scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationListV1Beta1Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePriorityLevelConfigurationListV1Beta1", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePriorityLevelConfigurationListV1Beta1_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationListV1Beta1_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationListV1Beta1", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePriorityLevelConfigurationListV1Beta1_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationListV1Beta1_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationListV1Beta1", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.flowcontrol.v1beta1.PriorityLevelConfigurationList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePriorityLevelConfigurationListV1Beta1_Manifest(props *KubePriorityLevelConfigurationListV1Beta1Props) interface{} { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationListV1Beta1_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationListV1Beta1", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePriorityLevelConfigurationListV1Beta1_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationListV1Beta1_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationListV1Beta1", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePriorityLevelConfigurationListV1Beta1_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePriorityLevelConfigurationListV1Beta1", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationListV1Beta1) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1Props.go new file mode 100644 index 0000000..4765190 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1Props.go @@ -0,0 +1,13 @@ +package k8s + + +// PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects. +type KubePriorityLevelConfigurationListV1Beta1Props struct { + // `items` is a list of request-priorities. + Items *[]*KubePriorityLevelConfigurationV1Beta1Props `field:"required" json:"items" yaml:"items"` + // `metadata` is the standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1__checks.go new file mode 100644 index 0000000..bc11615 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePriorityLevelConfigurationListV1Beta1_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta1_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta1_ManifestParameters(props *KubePriorityLevelConfigurationListV1Beta1Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta1_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePriorityLevelConfigurationListV1Beta1Parameters(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationListV1Beta1Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1__no_checks.go new file mode 100644 index 0000000..c0f7d52 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta1__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePriorityLevelConfigurationListV1Beta1_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta1_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta1_ManifestParameters(props *KubePriorityLevelConfigurationListV1Beta1Props) error { + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta1_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePriorityLevelConfigurationListV1Beta1Parameters(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationListV1Beta1Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2.go new file mode 100644 index 0000000..ebb634c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects. +type KubePriorityLevelConfigurationListV1Beta2 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePriorityLevelConfigurationListV1Beta2 +type jsiiProxy_KubePriorityLevelConfigurationListV1Beta2 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.flowcontrol.v1beta2.PriorityLevelConfigurationList" API object. +func NewKubePriorityLevelConfigurationListV1Beta2(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationListV1Beta2Props) KubePriorityLevelConfigurationListV1Beta2 { + _init_.Initialize() + + if err := validateNewKubePriorityLevelConfigurationListV1Beta2Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePriorityLevelConfigurationListV1Beta2{} + + _jsii_.Create( + "k8s.KubePriorityLevelConfigurationListV1Beta2", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.flowcontrol.v1beta2.PriorityLevelConfigurationList" API object. +func NewKubePriorityLevelConfigurationListV1Beta2_Override(k KubePriorityLevelConfigurationListV1Beta2, scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationListV1Beta2Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePriorityLevelConfigurationListV1Beta2", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePriorityLevelConfigurationListV1Beta2_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationListV1Beta2_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationListV1Beta2", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePriorityLevelConfigurationListV1Beta2_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationListV1Beta2_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationListV1Beta2", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.flowcontrol.v1beta2.PriorityLevelConfigurationList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePriorityLevelConfigurationListV1Beta2_Manifest(props *KubePriorityLevelConfigurationListV1Beta2Props) interface{} { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationListV1Beta2_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationListV1Beta2", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePriorityLevelConfigurationListV1Beta2_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationListV1Beta2_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationListV1Beta2", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePriorityLevelConfigurationListV1Beta2_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePriorityLevelConfigurationListV1Beta2", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationListV1Beta2) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2Props.go new file mode 100644 index 0000000..ec107a8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2Props.go @@ -0,0 +1,13 @@ +package k8s + + +// PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects. +type KubePriorityLevelConfigurationListV1Beta2Props struct { + // `items` is a list of request-priorities. + Items *[]*KubePriorityLevelConfigurationV1Beta2Props `field:"required" json:"items" yaml:"items"` + // `metadata` is the standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2__checks.go new file mode 100644 index 0000000..70cbd92 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePriorityLevelConfigurationListV1Beta2_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta2_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta2_ManifestParameters(props *KubePriorityLevelConfigurationListV1Beta2Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta2_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePriorityLevelConfigurationListV1Beta2Parameters(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationListV1Beta2Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2__no_checks.go new file mode 100644 index 0000000..0916d17 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationListV1Beta2__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePriorityLevelConfigurationListV1Beta2_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta2_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta2_ManifestParameters(props *KubePriorityLevelConfigurationListV1Beta2Props) error { + return nil +} + +func validateKubePriorityLevelConfigurationListV1Beta2_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePriorityLevelConfigurationListV1Beta2Parameters(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationListV1Beta2Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1.go new file mode 100644 index 0000000..8fc7886 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PriorityLevelConfiguration represents the configuration of a priority level. +type KubePriorityLevelConfigurationV1Beta1 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePriorityLevelConfigurationV1Beta1 +type jsiiProxy_KubePriorityLevelConfigurationV1Beta1 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.flowcontrol.v1beta1.PriorityLevelConfiguration" API object. +func NewKubePriorityLevelConfigurationV1Beta1(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationV1Beta1Props) KubePriorityLevelConfigurationV1Beta1 { + _init_.Initialize() + + if err := validateNewKubePriorityLevelConfigurationV1Beta1Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePriorityLevelConfigurationV1Beta1{} + + _jsii_.Create( + "k8s.KubePriorityLevelConfigurationV1Beta1", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.flowcontrol.v1beta1.PriorityLevelConfiguration" API object. +func NewKubePriorityLevelConfigurationV1Beta1_Override(k KubePriorityLevelConfigurationV1Beta1, scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationV1Beta1Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePriorityLevelConfigurationV1Beta1", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePriorityLevelConfigurationV1Beta1_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationV1Beta1_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationV1Beta1", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePriorityLevelConfigurationV1Beta1_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationV1Beta1_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationV1Beta1", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.flowcontrol.v1beta1.PriorityLevelConfiguration". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePriorityLevelConfigurationV1Beta1_Manifest(props *KubePriorityLevelConfigurationV1Beta1Props) interface{} { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationV1Beta1_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationV1Beta1", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePriorityLevelConfigurationV1Beta1_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationV1Beta1_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationV1Beta1", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePriorityLevelConfigurationV1Beta1_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePriorityLevelConfigurationV1Beta1", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationV1Beta1) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1Props.go new file mode 100644 index 0000000..3800f8e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1Props.go @@ -0,0 +1,15 @@ +package k8s + + +// PriorityLevelConfiguration represents the configuration of a priority level. +type KubePriorityLevelConfigurationV1Beta1Props struct { + // `metadata` is the standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // `spec` is the specification of the desired behavior of a "request-priority". + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *PriorityLevelConfigurationSpecV1Beta1 `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1__checks.go new file mode 100644 index 0000000..03c3b3f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePriorityLevelConfigurationV1Beta1_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta1_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta1_ManifestParameters(props *KubePriorityLevelConfigurationV1Beta1Props) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta1_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePriorityLevelConfigurationV1Beta1Parameters(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationV1Beta1Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1__no_checks.go new file mode 100644 index 0000000..2cf8950 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta1__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePriorityLevelConfigurationV1Beta1_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta1_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta1_ManifestParameters(props *KubePriorityLevelConfigurationV1Beta1Props) error { + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta1_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePriorityLevelConfigurationV1Beta1Parameters(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationV1Beta1Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2.go new file mode 100644 index 0000000..329c71d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// PriorityLevelConfiguration represents the configuration of a priority level. +type KubePriorityLevelConfigurationV1Beta2 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubePriorityLevelConfigurationV1Beta2 +type jsiiProxy_KubePriorityLevelConfigurationV1Beta2 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.flowcontrol.v1beta2.PriorityLevelConfiguration" API object. +func NewKubePriorityLevelConfigurationV1Beta2(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationV1Beta2Props) KubePriorityLevelConfigurationV1Beta2 { + _init_.Initialize() + + if err := validateNewKubePriorityLevelConfigurationV1Beta2Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubePriorityLevelConfigurationV1Beta2{} + + _jsii_.Create( + "k8s.KubePriorityLevelConfigurationV1Beta2", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.flowcontrol.v1beta2.PriorityLevelConfiguration" API object. +func NewKubePriorityLevelConfigurationV1Beta2_Override(k KubePriorityLevelConfigurationV1Beta2, scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationV1Beta2Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubePriorityLevelConfigurationV1Beta2", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubePriorityLevelConfigurationV1Beta2_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationV1Beta2_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationV1Beta2", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubePriorityLevelConfigurationV1Beta2_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationV1Beta2_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationV1Beta2", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.flowcontrol.v1beta2.PriorityLevelConfiguration". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubePriorityLevelConfigurationV1Beta2_Manifest(props *KubePriorityLevelConfigurationV1Beta2Props) interface{} { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationV1Beta2_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationV1Beta2", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubePriorityLevelConfigurationV1Beta2_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubePriorityLevelConfigurationV1Beta2_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubePriorityLevelConfigurationV1Beta2", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubePriorityLevelConfigurationV1Beta2_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubePriorityLevelConfigurationV1Beta2", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubePriorityLevelConfigurationV1Beta2) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2Props.go new file mode 100644 index 0000000..5fc6418 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2Props.go @@ -0,0 +1,15 @@ +package k8s + + +// PriorityLevelConfiguration represents the configuration of a priority level. +type KubePriorityLevelConfigurationV1Beta2Props struct { + // `metadata` is the standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // `spec` is the specification of the desired behavior of a "request-priority". + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *PriorityLevelConfigurationSpecV1Beta2 `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2__checks.go new file mode 100644 index 0000000..6dbb577 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubePriorityLevelConfigurationV1Beta2_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta2_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta2_ManifestParameters(props *KubePriorityLevelConfigurationV1Beta2Props) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta2_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubePriorityLevelConfigurationV1Beta2Parameters(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationV1Beta2Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2__no_checks.go new file mode 100644 index 0000000..cd22738 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubePriorityLevelConfigurationV1Beta2__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubePriorityLevelConfigurationV1Beta2_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta2_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta2_ManifestParameters(props *KubePriorityLevelConfigurationV1Beta2Props) error { + return nil +} + +func validateKubePriorityLevelConfigurationV1Beta2_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubePriorityLevelConfigurationV1Beta2Parameters(scope constructs.Construct, id *string, props *KubePriorityLevelConfigurationV1Beta2Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSet.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSet.go new file mode 100644 index 0000000..14aeed0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSet.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ReplicaSet ensures that a specified number of pod replicas are running at any given time. +type KubeReplicaSet interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeReplicaSet +type jsiiProxy_KubeReplicaSet struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeReplicaSet) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSet) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSet) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSet) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSet) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSet) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSet) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apps.v1.ReplicaSet" API object. +func NewKubeReplicaSet(scope constructs.Construct, id *string, props *KubeReplicaSetProps) KubeReplicaSet { + _init_.Initialize() + + if err := validateNewKubeReplicaSetParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeReplicaSet{} + + _jsii_.Create( + "k8s.KubeReplicaSet", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apps.v1.ReplicaSet" API object. +func NewKubeReplicaSet_Override(k KubeReplicaSet, scope constructs.Construct, id *string, props *KubeReplicaSetProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeReplicaSet", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeReplicaSet_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeReplicaSet_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeReplicaSet", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeReplicaSet_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeReplicaSet_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeReplicaSet", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apps.v1.ReplicaSet". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeReplicaSet_Manifest(props *KubeReplicaSetProps) interface{} { + _init_.Initialize() + + if err := validateKubeReplicaSet_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeReplicaSet", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeReplicaSet_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeReplicaSet_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeReplicaSet", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeReplicaSet_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeReplicaSet", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeReplicaSet) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeReplicaSet) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeReplicaSet) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeReplicaSet) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetList.go new file mode 100644 index 0000000..be3ad03 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ReplicaSetList is a collection of ReplicaSets. +type KubeReplicaSetList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeReplicaSetList +type jsiiProxy_KubeReplicaSetList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeReplicaSetList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSetList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSetList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSetList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSetList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSetList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicaSetList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apps.v1.ReplicaSetList" API object. +func NewKubeReplicaSetList(scope constructs.Construct, id *string, props *KubeReplicaSetListProps) KubeReplicaSetList { + _init_.Initialize() + + if err := validateNewKubeReplicaSetListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeReplicaSetList{} + + _jsii_.Create( + "k8s.KubeReplicaSetList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apps.v1.ReplicaSetList" API object. +func NewKubeReplicaSetList_Override(k KubeReplicaSetList, scope constructs.Construct, id *string, props *KubeReplicaSetListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeReplicaSetList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeReplicaSetList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeReplicaSetList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeReplicaSetList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeReplicaSetList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeReplicaSetList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeReplicaSetList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apps.v1.ReplicaSetList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeReplicaSetList_Manifest(props *KubeReplicaSetListProps) interface{} { + _init_.Initialize() + + if err := validateKubeReplicaSetList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeReplicaSetList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeReplicaSetList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeReplicaSetList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeReplicaSetList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeReplicaSetList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeReplicaSetList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeReplicaSetList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeReplicaSetList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeReplicaSetList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeReplicaSetList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetListProps.go new file mode 100644 index 0000000..fbfa952 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// ReplicaSetList is a collection of ReplicaSets. +type KubeReplicaSetListProps struct { + // List of ReplicaSets. + // + // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller + Items *[]*KubeReplicaSetProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetList__checks.go new file mode 100644 index 0000000..36f37f8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeReplicaSetList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeReplicaSetList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeReplicaSetList_ManifestParameters(props *KubeReplicaSetListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeReplicaSetList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeReplicaSetListParameters(scope constructs.Construct, id *string, props *KubeReplicaSetListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetList__no_checks.go new file mode 100644 index 0000000..5ab7a4e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeReplicaSetList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeReplicaSetList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeReplicaSetList_ManifestParameters(props *KubeReplicaSetListProps) error { + return nil +} + +func validateKubeReplicaSetList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeReplicaSetListParameters(scope constructs.Construct, id *string, props *KubeReplicaSetListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetProps.go new file mode 100644 index 0000000..0e1c3fd --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSetProps.go @@ -0,0 +1,15 @@ +package k8s + + +// ReplicaSet ensures that a specified number of pod replicas are running at any given time. +type KubeReplicaSetProps struct { + // If the Labels of a ReplicaSet are empty, they are defaulted to be the same as the Pod(s) that the ReplicaSet manages. + // + // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec defines the specification of the desired behavior of the ReplicaSet. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *ReplicaSetSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSet__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSet__checks.go new file mode 100644 index 0000000..3fb1824 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSet__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeReplicaSet_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeReplicaSet_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeReplicaSet_ManifestParameters(props *KubeReplicaSetProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeReplicaSet_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeReplicaSetParameters(scope constructs.Construct, id *string, props *KubeReplicaSetProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSet__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSet__no_checks.go new file mode 100644 index 0000000..539e53d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicaSet__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeReplicaSet_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeReplicaSet_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeReplicaSet_ManifestParameters(props *KubeReplicaSetProps) error { + return nil +} + +func validateKubeReplicaSet_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeReplicaSetParameters(scope constructs.Construct, id *string, props *KubeReplicaSetProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationController.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationController.go new file mode 100644 index 0000000..12c25f0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationController.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ReplicationController represents the configuration of a replication controller. +type KubeReplicationController interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeReplicationController +type jsiiProxy_KubeReplicationController struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeReplicationController) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationController) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationController) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationController) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationController) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationController) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationController) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ReplicationController" API object. +func NewKubeReplicationController(scope constructs.Construct, id *string, props *KubeReplicationControllerProps) KubeReplicationController { + _init_.Initialize() + + if err := validateNewKubeReplicationControllerParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeReplicationController{} + + _jsii_.Create( + "k8s.KubeReplicationController", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ReplicationController" API object. +func NewKubeReplicationController_Override(k KubeReplicationController, scope constructs.Construct, id *string, props *KubeReplicationControllerProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeReplicationController", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeReplicationController_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeReplicationController_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeReplicationController", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeReplicationController_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeReplicationController_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeReplicationController", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ReplicationController". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeReplicationController_Manifest(props *KubeReplicationControllerProps) interface{} { + _init_.Initialize() + + if err := validateKubeReplicationController_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeReplicationController", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeReplicationController_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeReplicationController_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeReplicationController", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeReplicationController_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeReplicationController", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeReplicationController) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeReplicationController) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeReplicationController) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeReplicationController) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerList.go new file mode 100644 index 0000000..f127cbb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ReplicationControllerList is a collection of replication controllers. +type KubeReplicationControllerList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeReplicationControllerList +type jsiiProxy_KubeReplicationControllerList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeReplicationControllerList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationControllerList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationControllerList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationControllerList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationControllerList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationControllerList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeReplicationControllerList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ReplicationControllerList" API object. +func NewKubeReplicationControllerList(scope constructs.Construct, id *string, props *KubeReplicationControllerListProps) KubeReplicationControllerList { + _init_.Initialize() + + if err := validateNewKubeReplicationControllerListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeReplicationControllerList{} + + _jsii_.Create( + "k8s.KubeReplicationControllerList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ReplicationControllerList" API object. +func NewKubeReplicationControllerList_Override(k KubeReplicationControllerList, scope constructs.Construct, id *string, props *KubeReplicationControllerListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeReplicationControllerList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeReplicationControllerList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeReplicationControllerList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeReplicationControllerList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeReplicationControllerList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeReplicationControllerList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeReplicationControllerList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ReplicationControllerList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeReplicationControllerList_Manifest(props *KubeReplicationControllerListProps) interface{} { + _init_.Initialize() + + if err := validateKubeReplicationControllerList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeReplicationControllerList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeReplicationControllerList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeReplicationControllerList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeReplicationControllerList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeReplicationControllerList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeReplicationControllerList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeReplicationControllerList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeReplicationControllerList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeReplicationControllerList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeReplicationControllerList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerListProps.go new file mode 100644 index 0000000..cb96743 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// ReplicationControllerList is a collection of replication controllers. +type KubeReplicationControllerListProps struct { + // List of replication controllers. + // + // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller + Items *[]*KubeReplicationControllerProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerList__checks.go new file mode 100644 index 0000000..8d4f7e3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeReplicationControllerList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeReplicationControllerList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeReplicationControllerList_ManifestParameters(props *KubeReplicationControllerListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeReplicationControllerList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeReplicationControllerListParameters(scope constructs.Construct, id *string, props *KubeReplicationControllerListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerList__no_checks.go new file mode 100644 index 0000000..7246962 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeReplicationControllerList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeReplicationControllerList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeReplicationControllerList_ManifestParameters(props *KubeReplicationControllerListProps) error { + return nil +} + +func validateKubeReplicationControllerList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeReplicationControllerListParameters(scope constructs.Construct, id *string, props *KubeReplicationControllerListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerProps.go new file mode 100644 index 0000000..a608657 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationControllerProps.go @@ -0,0 +1,15 @@ +package k8s + + +// ReplicationController represents the configuration of a replication controller. +type KubeReplicationControllerProps struct { + // If the Labels of a ReplicationController are empty, they are defaulted to be the same as the Pod(s) that the replication controller manages. + // + // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec defines the specification of the desired behavior of the replication controller. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *ReplicationControllerSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationController__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationController__checks.go new file mode 100644 index 0000000..279a34a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationController__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeReplicationController_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeReplicationController_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeReplicationController_ManifestParameters(props *KubeReplicationControllerProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeReplicationController_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeReplicationControllerParameters(scope constructs.Construct, id *string, props *KubeReplicationControllerProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationController__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationController__no_checks.go new file mode 100644 index 0000000..cd75cd2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeReplicationController__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeReplicationController_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeReplicationController_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeReplicationController_ManifestParameters(props *KubeReplicationControllerProps) error { + return nil +} + +func validateKubeReplicationController_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeReplicationControllerParameters(scope constructs.Construct, id *string, props *KubeReplicationControllerProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuota.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuota.go new file mode 100644 index 0000000..95a1e7b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuota.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ResourceQuota sets aggregate quota restrictions enforced per namespace. +type KubeResourceQuota interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeResourceQuota +type jsiiProxy_KubeResourceQuota struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeResourceQuota) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuota) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuota) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuota) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuota) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuota) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuota) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ResourceQuota" API object. +func NewKubeResourceQuota(scope constructs.Construct, id *string, props *KubeResourceQuotaProps) KubeResourceQuota { + _init_.Initialize() + + if err := validateNewKubeResourceQuotaParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeResourceQuota{} + + _jsii_.Create( + "k8s.KubeResourceQuota", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ResourceQuota" API object. +func NewKubeResourceQuota_Override(k KubeResourceQuota, scope constructs.Construct, id *string, props *KubeResourceQuotaProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeResourceQuota", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeResourceQuota_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeResourceQuota_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeResourceQuota", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeResourceQuota_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeResourceQuota_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeResourceQuota", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ResourceQuota". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeResourceQuota_Manifest(props *KubeResourceQuotaProps) interface{} { + _init_.Initialize() + + if err := validateKubeResourceQuota_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeResourceQuota", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeResourceQuota_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeResourceQuota_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeResourceQuota", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeResourceQuota_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeResourceQuota", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeResourceQuota) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeResourceQuota) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeResourceQuota) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeResourceQuota) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaList.go new file mode 100644 index 0000000..69e9207 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ResourceQuotaList is a list of ResourceQuota items. +type KubeResourceQuotaList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeResourceQuotaList +type jsiiProxy_KubeResourceQuotaList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeResourceQuotaList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuotaList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuotaList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuotaList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuotaList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuotaList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeResourceQuotaList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ResourceQuotaList" API object. +func NewKubeResourceQuotaList(scope constructs.Construct, id *string, props *KubeResourceQuotaListProps) KubeResourceQuotaList { + _init_.Initialize() + + if err := validateNewKubeResourceQuotaListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeResourceQuotaList{} + + _jsii_.Create( + "k8s.KubeResourceQuotaList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ResourceQuotaList" API object. +func NewKubeResourceQuotaList_Override(k KubeResourceQuotaList, scope constructs.Construct, id *string, props *KubeResourceQuotaListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeResourceQuotaList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeResourceQuotaList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeResourceQuotaList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeResourceQuotaList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeResourceQuotaList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeResourceQuotaList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeResourceQuotaList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ResourceQuotaList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeResourceQuotaList_Manifest(props *KubeResourceQuotaListProps) interface{} { + _init_.Initialize() + + if err := validateKubeResourceQuotaList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeResourceQuotaList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeResourceQuotaList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeResourceQuotaList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeResourceQuotaList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeResourceQuotaList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeResourceQuotaList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeResourceQuotaList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeResourceQuotaList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeResourceQuotaList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeResourceQuotaList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaListProps.go new file mode 100644 index 0000000..c9efde9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// ResourceQuotaList is a list of ResourceQuota items. +type KubeResourceQuotaListProps struct { + // Items is a list of ResourceQuota objects. + // + // More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/ + Items *[]*KubeResourceQuotaProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaList__checks.go new file mode 100644 index 0000000..c011cb6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeResourceQuotaList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeResourceQuotaList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeResourceQuotaList_ManifestParameters(props *KubeResourceQuotaListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeResourceQuotaList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeResourceQuotaListParameters(scope constructs.Construct, id *string, props *KubeResourceQuotaListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaList__no_checks.go new file mode 100644 index 0000000..367e30c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeResourceQuotaList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeResourceQuotaList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeResourceQuotaList_ManifestParameters(props *KubeResourceQuotaListProps) error { + return nil +} + +func validateKubeResourceQuotaList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeResourceQuotaListParameters(scope constructs.Construct, id *string, props *KubeResourceQuotaListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaProps.go new file mode 100644 index 0000000..6f0d5da --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuotaProps.go @@ -0,0 +1,15 @@ +package k8s + + +// ResourceQuota sets aggregate quota restrictions enforced per namespace. +type KubeResourceQuotaProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec defines the desired quota. + // + // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *ResourceQuotaSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuota__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuota__checks.go new file mode 100644 index 0000000..c0c977e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuota__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeResourceQuota_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeResourceQuota_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeResourceQuota_ManifestParameters(props *KubeResourceQuotaProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeResourceQuota_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeResourceQuotaParameters(scope constructs.Construct, id *string, props *KubeResourceQuotaProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuota__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuota__no_checks.go new file mode 100644 index 0000000..e1c2485 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeResourceQuota__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeResourceQuota_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeResourceQuota_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeResourceQuota_ManifestParameters(props *KubeResourceQuotaProps) error { + return nil +} + +func validateKubeResourceQuota_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeResourceQuotaParameters(scope constructs.Construct, id *string, props *KubeResourceQuotaProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRole.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRole.go new file mode 100644 index 0000000..7187000 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRole.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. +type KubeRole interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeRole +type jsiiProxy_KubeRole struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeRole) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRole) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRole) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRole) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRole) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRole) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRole) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.rbac.v1.Role" API object. +func NewKubeRole(scope constructs.Construct, id *string, props *KubeRoleProps) KubeRole { + _init_.Initialize() + + if err := validateNewKubeRoleParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeRole{} + + _jsii_.Create( + "k8s.KubeRole", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.rbac.v1.Role" API object. +func NewKubeRole_Override(k KubeRole, scope constructs.Construct, id *string, props *KubeRoleProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeRole", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeRole_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRole_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRole", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeRole_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRole_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRole", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.rbac.v1.Role". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeRole_Manifest(props *KubeRoleProps) interface{} { + _init_.Initialize() + + if err := validateKubeRole_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeRole", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeRole_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeRole_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeRole", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeRole_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeRole", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeRole) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeRole) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeRole) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeRole) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBinding.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBinding.go new file mode 100644 index 0000000..254a421 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBinding.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// RoleBinding references a role, but does not contain it. +// +// It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace. +type KubeRoleBinding interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeRoleBinding +type jsiiProxy_KubeRoleBinding struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeRoleBinding) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBinding) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBinding) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBinding) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBinding) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBinding) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBinding) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.rbac.v1.RoleBinding" API object. +func NewKubeRoleBinding(scope constructs.Construct, id *string, props *KubeRoleBindingProps) KubeRoleBinding { + _init_.Initialize() + + if err := validateNewKubeRoleBindingParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeRoleBinding{} + + _jsii_.Create( + "k8s.KubeRoleBinding", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.rbac.v1.RoleBinding" API object. +func NewKubeRoleBinding_Override(k KubeRoleBinding, scope constructs.Construct, id *string, props *KubeRoleBindingProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeRoleBinding", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeRoleBinding_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRoleBinding_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRoleBinding", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeRoleBinding_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRoleBinding_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRoleBinding", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.rbac.v1.RoleBinding". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeRoleBinding_Manifest(props *KubeRoleBindingProps) interface{} { + _init_.Initialize() + + if err := validateKubeRoleBinding_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeRoleBinding", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeRoleBinding_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeRoleBinding_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeRoleBinding", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeRoleBinding_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeRoleBinding", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeRoleBinding) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeRoleBinding) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeRoleBinding) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeRoleBinding) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingList.go new file mode 100644 index 0000000..e2f9582 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// RoleBindingList is a collection of RoleBindings. +type KubeRoleBindingList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeRoleBindingList +type jsiiProxy_KubeRoleBindingList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeRoleBindingList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBindingList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBindingList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBindingList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBindingList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBindingList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleBindingList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.rbac.v1.RoleBindingList" API object. +func NewKubeRoleBindingList(scope constructs.Construct, id *string, props *KubeRoleBindingListProps) KubeRoleBindingList { + _init_.Initialize() + + if err := validateNewKubeRoleBindingListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeRoleBindingList{} + + _jsii_.Create( + "k8s.KubeRoleBindingList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.rbac.v1.RoleBindingList" API object. +func NewKubeRoleBindingList_Override(k KubeRoleBindingList, scope constructs.Construct, id *string, props *KubeRoleBindingListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeRoleBindingList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeRoleBindingList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRoleBindingList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRoleBindingList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeRoleBindingList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRoleBindingList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRoleBindingList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.rbac.v1.RoleBindingList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeRoleBindingList_Manifest(props *KubeRoleBindingListProps) interface{} { + _init_.Initialize() + + if err := validateKubeRoleBindingList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeRoleBindingList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeRoleBindingList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeRoleBindingList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeRoleBindingList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeRoleBindingList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeRoleBindingList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeRoleBindingList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeRoleBindingList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeRoleBindingList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeRoleBindingList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingListProps.go new file mode 100644 index 0000000..db4566b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// RoleBindingList is a collection of RoleBindings. +type KubeRoleBindingListProps struct { + // Items is a list of RoleBindings. + Items *[]*KubeRoleBindingProps `field:"required" json:"items" yaml:"items"` + // Standard object's metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingList__checks.go new file mode 100644 index 0000000..ad0271d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeRoleBindingList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeRoleBindingList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeRoleBindingList_ManifestParameters(props *KubeRoleBindingListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeRoleBindingList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeRoleBindingListParameters(scope constructs.Construct, id *string, props *KubeRoleBindingListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingList__no_checks.go new file mode 100644 index 0000000..92f7423 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeRoleBindingList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeRoleBindingList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeRoleBindingList_ManifestParameters(props *KubeRoleBindingListProps) error { + return nil +} + +func validateKubeRoleBindingList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeRoleBindingListParameters(scope constructs.Construct, id *string, props *KubeRoleBindingListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingProps.go new file mode 100644 index 0000000..7ace4cf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBindingProps.go @@ -0,0 +1,17 @@ +package k8s + + +// RoleBinding references a role, but does not contain it. +// +// It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace. +type KubeRoleBindingProps struct { + // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // + // If the RoleRef cannot be resolved, the Authorizer must return an error. + RoleRef *RoleRef `field:"required" json:"roleRef" yaml:"roleRef"` + // Standard object's metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Subjects holds references to the objects the role applies to. + Subjects *[]*Subject `field:"optional" json:"subjects" yaml:"subjects"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBinding__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBinding__checks.go new file mode 100644 index 0000000..18456a4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBinding__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeRoleBinding_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeRoleBinding_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeRoleBinding_ManifestParameters(props *KubeRoleBindingProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeRoleBinding_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeRoleBindingParameters(scope constructs.Construct, id *string, props *KubeRoleBindingProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBinding__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBinding__no_checks.go new file mode 100644 index 0000000..1b5c7b0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleBinding__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeRoleBinding_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeRoleBinding_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeRoleBinding_ManifestParameters(props *KubeRoleBindingProps) error { + return nil +} + +func validateKubeRoleBinding_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeRoleBindingParameters(scope constructs.Construct, id *string, props *KubeRoleBindingProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleList.go new file mode 100644 index 0000000..c5d155d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// RoleList is a collection of Roles. +type KubeRoleList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeRoleList +type jsiiProxy_KubeRoleList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeRoleList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRoleList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.rbac.v1.RoleList" API object. +func NewKubeRoleList(scope constructs.Construct, id *string, props *KubeRoleListProps) KubeRoleList { + _init_.Initialize() + + if err := validateNewKubeRoleListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeRoleList{} + + _jsii_.Create( + "k8s.KubeRoleList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.rbac.v1.RoleList" API object. +func NewKubeRoleList_Override(k KubeRoleList, scope constructs.Construct, id *string, props *KubeRoleListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeRoleList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeRoleList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRoleList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRoleList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeRoleList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRoleList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRoleList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.rbac.v1.RoleList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeRoleList_Manifest(props *KubeRoleListProps) interface{} { + _init_.Initialize() + + if err := validateKubeRoleList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeRoleList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeRoleList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeRoleList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeRoleList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeRoleList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeRoleList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeRoleList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeRoleList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeRoleList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeRoleList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleListProps.go new file mode 100644 index 0000000..f90d4e5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// RoleList is a collection of Roles. +type KubeRoleListProps struct { + // Items is a list of Roles. + Items *[]*KubeRoleProps `field:"required" json:"items" yaml:"items"` + // Standard object's metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleList__checks.go new file mode 100644 index 0000000..ced0b0b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeRoleList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeRoleList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeRoleList_ManifestParameters(props *KubeRoleListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeRoleList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeRoleListParameters(scope constructs.Construct, id *string, props *KubeRoleListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleList__no_checks.go new file mode 100644 index 0000000..69b7666 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeRoleList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeRoleList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeRoleList_ManifestParameters(props *KubeRoleListProps) error { + return nil +} + +func validateKubeRoleList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeRoleListParameters(scope constructs.Construct, id *string, props *KubeRoleListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleProps.go new file mode 100644 index 0000000..0b089c9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRoleProps.go @@ -0,0 +1,11 @@ +package k8s + + +// Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. +type KubeRoleProps struct { + // Standard object's metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Rules holds all the PolicyRules for this Role. + Rules *[]*PolicyRule `field:"optional" json:"rules" yaml:"rules"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRole__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRole__checks.go new file mode 100644 index 0000000..25b759f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRole__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeRole_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeRole_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeRole_ManifestParameters(props *KubeRoleProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeRole_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeRoleParameters(scope constructs.Construct, id *string, props *KubeRoleProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRole__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRole__no_checks.go new file mode 100644 index 0000000..12ff299 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRole__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeRole_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeRole_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeRole_ManifestParameters(props *KubeRoleProps) error { + return nil +} + +func validateKubeRole_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeRoleParameters(scope constructs.Construct, id *string, props *KubeRoleProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClass.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClass.go new file mode 100644 index 0000000..9dff9cf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClass.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// RuntimeClass defines a class of container runtime supported in the cluster. +// +// The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://kubernetes.io/docs/concepts/containers/runtime-class/ +type KubeRuntimeClass interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeRuntimeClass +type jsiiProxy_KubeRuntimeClass struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeRuntimeClass) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClass) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClass) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClass) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClass) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClass) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClass) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.node.v1.RuntimeClass" API object. +func NewKubeRuntimeClass(scope constructs.Construct, id *string, props *KubeRuntimeClassProps) KubeRuntimeClass { + _init_.Initialize() + + if err := validateNewKubeRuntimeClassParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeRuntimeClass{} + + _jsii_.Create( + "k8s.KubeRuntimeClass", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.node.v1.RuntimeClass" API object. +func NewKubeRuntimeClass_Override(k KubeRuntimeClass, scope constructs.Construct, id *string, props *KubeRuntimeClassProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeRuntimeClass", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeRuntimeClass_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRuntimeClass_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRuntimeClass", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeRuntimeClass_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRuntimeClass_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRuntimeClass", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.node.v1.RuntimeClass". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeRuntimeClass_Manifest(props *KubeRuntimeClassProps) interface{} { + _init_.Initialize() + + if err := validateKubeRuntimeClass_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeRuntimeClass", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeRuntimeClass_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeRuntimeClass_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeRuntimeClass", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeRuntimeClass_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeRuntimeClass", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeRuntimeClass) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeRuntimeClass) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeRuntimeClass) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeRuntimeClass) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassList.go new file mode 100644 index 0000000..058d9ca --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// RuntimeClassList is a list of RuntimeClass objects. +type KubeRuntimeClassList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeRuntimeClassList +type jsiiProxy_KubeRuntimeClassList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeRuntimeClassList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClassList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClassList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClassList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClassList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClassList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeRuntimeClassList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.node.v1.RuntimeClassList" API object. +func NewKubeRuntimeClassList(scope constructs.Construct, id *string, props *KubeRuntimeClassListProps) KubeRuntimeClassList { + _init_.Initialize() + + if err := validateNewKubeRuntimeClassListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeRuntimeClassList{} + + _jsii_.Create( + "k8s.KubeRuntimeClassList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.node.v1.RuntimeClassList" API object. +func NewKubeRuntimeClassList_Override(k KubeRuntimeClassList, scope constructs.Construct, id *string, props *KubeRuntimeClassListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeRuntimeClassList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeRuntimeClassList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRuntimeClassList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRuntimeClassList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeRuntimeClassList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeRuntimeClassList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeRuntimeClassList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.node.v1.RuntimeClassList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeRuntimeClassList_Manifest(props *KubeRuntimeClassListProps) interface{} { + _init_.Initialize() + + if err := validateKubeRuntimeClassList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeRuntimeClassList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeRuntimeClassList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeRuntimeClassList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeRuntimeClassList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeRuntimeClassList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeRuntimeClassList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeRuntimeClassList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeRuntimeClassList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeRuntimeClassList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeRuntimeClassList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassListProps.go new file mode 100644 index 0000000..e186f35 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// RuntimeClassList is a list of RuntimeClass objects. +type KubeRuntimeClassListProps struct { + // Items is a list of schema objects. + Items *[]*KubeRuntimeClassProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassList__checks.go new file mode 100644 index 0000000..7e2e137 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeRuntimeClassList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeRuntimeClassList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeRuntimeClassList_ManifestParameters(props *KubeRuntimeClassListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeRuntimeClassList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeRuntimeClassListParameters(scope constructs.Construct, id *string, props *KubeRuntimeClassListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassList__no_checks.go new file mode 100644 index 0000000..b60dece --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeRuntimeClassList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeRuntimeClassList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeRuntimeClassList_ManifestParameters(props *KubeRuntimeClassListProps) error { + return nil +} + +func validateKubeRuntimeClassList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeRuntimeClassListParameters(scope constructs.Construct, id *string, props *KubeRuntimeClassListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassProps.go new file mode 100644 index 0000000..2e13cc5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClassProps.go @@ -0,0 +1,24 @@ +package k8s + + +// RuntimeClass defines a class of container runtime supported in the cluster. +// +// The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://kubernetes.io/docs/concepts/containers/runtime-class/ +type KubeRuntimeClassProps struct { + // Handler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. + // + // The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called "runc" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable. + Handler *string `field:"required" json:"handler" yaml:"handler"` + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. + // + // For more details, see + // https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/ + Overhead *Overhead `field:"optional" json:"overhead" yaml:"overhead"` + // Scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. + // + // If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes. + Scheduling *Scheduling `field:"optional" json:"scheduling" yaml:"scheduling"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClass__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClass__checks.go new file mode 100644 index 0000000..9bb23df --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClass__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeRuntimeClass_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeRuntimeClass_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeRuntimeClass_ManifestParameters(props *KubeRuntimeClassProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeRuntimeClass_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeRuntimeClassParameters(scope constructs.Construct, id *string, props *KubeRuntimeClassProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClass__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClass__no_checks.go new file mode 100644 index 0000000..63c9045 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeRuntimeClass__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeRuntimeClass_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeRuntimeClass_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeRuntimeClass_ManifestParameters(props *KubeRuntimeClassProps) error { + return nil +} + +func validateKubeRuntimeClass_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeRuntimeClassParameters(scope constructs.Construct, id *string, props *KubeRuntimeClassProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeScale.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeScale.go new file mode 100644 index 0000000..c09f47c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeScale.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Scale represents a scaling request for a resource. +type KubeScale interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeScale +type jsiiProxy_KubeScale struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeScale) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeScale) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeScale) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeScale) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeScale) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeScale) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeScale) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.autoscaling.v1.Scale" API object. +func NewKubeScale(scope constructs.Construct, id *string, props *KubeScaleProps) KubeScale { + _init_.Initialize() + + if err := validateNewKubeScaleParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeScale{} + + _jsii_.Create( + "k8s.KubeScale", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.autoscaling.v1.Scale" API object. +func NewKubeScale_Override(k KubeScale, scope constructs.Construct, id *string, props *KubeScaleProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeScale", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeScale_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeScale_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeScale", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeScale_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeScale_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeScale", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.autoscaling.v1.Scale". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeScale_Manifest(props *KubeScaleProps) interface{} { + _init_.Initialize() + + if err := validateKubeScale_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeScale", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeScale_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeScale_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeScale", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeScale_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeScale", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeScale) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeScale) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeScale) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeScale) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeScaleProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeScaleProps.go new file mode 100644 index 0000000..a5db5c0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeScaleProps.go @@ -0,0 +1,15 @@ +package k8s + + +// Scale represents a scaling request for a resource. +type KubeScaleProps struct { + // Standard object metadata; + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // defines the behavior of the scale. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + Spec *ScaleSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeScale__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeScale__checks.go new file mode 100644 index 0000000..0c4c591 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeScale__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeScale_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeScale_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeScale_ManifestParameters(props *KubeScaleProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeScale_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeScaleParameters(scope constructs.Construct, id *string, props *KubeScaleProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeScale__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeScale__no_checks.go new file mode 100644 index 0000000..3afdbbf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeScale__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeScale_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeScale_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeScale_ManifestParameters(props *KubeScaleProps) error { + return nil +} + +func validateKubeScale_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeScaleParameters(scope constructs.Construct, id *string, props *KubeScaleProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSecret.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecret.go new file mode 100644 index 0000000..75eeced --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecret.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Secret holds secret data of a certain type. +// +// The total bytes of the values in the Data field must be less than MaxSecretSize bytes. +type KubeSecret interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeSecret +type jsiiProxy_KubeSecret struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeSecret) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecret) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecret) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecret) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecret) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecret) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecret) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.Secret" API object. +func NewKubeSecret(scope constructs.Construct, id *string, props *KubeSecretProps) KubeSecret { + _init_.Initialize() + + if err := validateNewKubeSecretParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeSecret{} + + _jsii_.Create( + "k8s.KubeSecret", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.Secret" API object. +func NewKubeSecret_Override(k KubeSecret, scope constructs.Construct, id *string, props *KubeSecretProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeSecret", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeSecret_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeSecret_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeSecret", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeSecret_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeSecret_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeSecret", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.Secret". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeSecret_Manifest(props *KubeSecretProps) interface{} { + _init_.Initialize() + + if err := validateKubeSecret_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeSecret", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeSecret_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeSecret_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeSecret", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeSecret_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeSecret", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeSecret) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeSecret) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeSecret) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeSecret) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretList.go new file mode 100644 index 0000000..d00fc8f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// SecretList is a list of Secret. +type KubeSecretList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeSecretList +type jsiiProxy_KubeSecretList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeSecretList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecretList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecretList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecretList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecretList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecretList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSecretList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.SecretList" API object. +func NewKubeSecretList(scope constructs.Construct, id *string, props *KubeSecretListProps) KubeSecretList { + _init_.Initialize() + + if err := validateNewKubeSecretListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeSecretList{} + + _jsii_.Create( + "k8s.KubeSecretList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.SecretList" API object. +func NewKubeSecretList_Override(k KubeSecretList, scope constructs.Construct, id *string, props *KubeSecretListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeSecretList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeSecretList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeSecretList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeSecretList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeSecretList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeSecretList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeSecretList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.SecretList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeSecretList_Manifest(props *KubeSecretListProps) interface{} { + _init_.Initialize() + + if err := validateKubeSecretList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeSecretList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeSecretList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeSecretList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeSecretList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeSecretList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeSecretList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeSecretList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeSecretList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeSecretList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeSecretList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretListProps.go new file mode 100644 index 0000000..dc539e8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// SecretList is a list of Secret. +type KubeSecretListProps struct { + // Items is a list of secret objects. + // + // More info: https://kubernetes.io/docs/concepts/configuration/secret + Items *[]*KubeSecretProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretList__checks.go new file mode 100644 index 0000000..fb7ecad --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeSecretList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeSecretList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeSecretList_ManifestParameters(props *KubeSecretListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeSecretList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeSecretListParameters(scope constructs.Construct, id *string, props *KubeSecretListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretList__no_checks.go new file mode 100644 index 0000000..7240e51 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeSecretList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeSecretList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeSecretList_ManifestParameters(props *KubeSecretListProps) error { + return nil +} + +func validateKubeSecretList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeSecretListParameters(scope constructs.Construct, id *string, props *KubeSecretListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretProps.go new file mode 100644 index 0000000..d63426f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecretProps.go @@ -0,0 +1,29 @@ +package k8s + + +// Secret holds secret data of a certain type. +// +// The total bytes of the values in the Data field must be less than MaxSecretSize bytes. +type KubeSecretProps struct { + // Data contains the secret data. + // + // Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4 + Data *map[string]*string `field:"optional" json:"data" yaml:"data"` + // Immutable, if set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified). + // + // If not set to true, the field can be modified at any time. Defaulted to nil. + Immutable *bool `field:"optional" json:"immutable" yaml:"immutable"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // stringData allows specifying non-binary secret data in string form. + // + // It is provided as a write-only input field for convenience. All keys and values are merged into the data field on write, overwriting any existing values. The stringData field is never output when reading from the API. + StringData *map[string]*string `field:"optional" json:"stringData" yaml:"stringData"` + // Used to facilitate programmatic handling of secret data. + // + // More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types + Type *string `field:"optional" json:"type" yaml:"type"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSecret__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecret__checks.go new file mode 100644 index 0000000..15c2baf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecret__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeSecret_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeSecret_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeSecret_ManifestParameters(props *KubeSecretProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeSecret_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeSecretParameters(scope constructs.Construct, id *string, props *KubeSecretProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSecret__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecret__no_checks.go new file mode 100644 index 0000000..f40d1cb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSecret__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeSecret_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeSecret_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeSecret_ManifestParameters(props *KubeSecretProps) error { + return nil +} + +func validateKubeSecret_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeSecretParameters(scope constructs.Construct, id *string, props *KubeSecretProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReview.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReview.go new file mode 100644 index 0000000..5be3ba6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReview.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// SelfSubjectAccessReview checks whether or the current user can perform an action. +// +// Not filling in a spec.namespace means "in all namespaces". Self is a special case, because users should always be able to check whether they can perform an action +type KubeSelfSubjectAccessReview interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeSelfSubjectAccessReview +type jsiiProxy_KubeSelfSubjectAccessReview struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeSelfSubjectAccessReview) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectAccessReview) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectAccessReview) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectAccessReview) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectAccessReview) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectAccessReview) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectAccessReview) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.authorization.v1.SelfSubjectAccessReview" API object. +func NewKubeSelfSubjectAccessReview(scope constructs.Construct, id *string, props *KubeSelfSubjectAccessReviewProps) KubeSelfSubjectAccessReview { + _init_.Initialize() + + if err := validateNewKubeSelfSubjectAccessReviewParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeSelfSubjectAccessReview{} + + _jsii_.Create( + "k8s.KubeSelfSubjectAccessReview", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.authorization.v1.SelfSubjectAccessReview" API object. +func NewKubeSelfSubjectAccessReview_Override(k KubeSelfSubjectAccessReview, scope constructs.Construct, id *string, props *KubeSelfSubjectAccessReviewProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeSelfSubjectAccessReview", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeSelfSubjectAccessReview_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeSelfSubjectAccessReview_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeSelfSubjectAccessReview", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeSelfSubjectAccessReview_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeSelfSubjectAccessReview_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeSelfSubjectAccessReview", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.authorization.v1.SelfSubjectAccessReview". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeSelfSubjectAccessReview_Manifest(props *KubeSelfSubjectAccessReviewProps) interface{} { + _init_.Initialize() + + if err := validateKubeSelfSubjectAccessReview_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeSelfSubjectAccessReview", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeSelfSubjectAccessReview_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeSelfSubjectAccessReview_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeSelfSubjectAccessReview", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeSelfSubjectAccessReview_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeSelfSubjectAccessReview", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeSelfSubjectAccessReview) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeSelfSubjectAccessReview) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeSelfSubjectAccessReview) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeSelfSubjectAccessReview) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReviewProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReviewProps.go new file mode 100644 index 0000000..dc4e53a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReviewProps.go @@ -0,0 +1,17 @@ +package k8s + + +// SelfSubjectAccessReview checks whether or the current user can perform an action. +// +// Not filling in a spec.namespace means "in all namespaces". Self is a special case, because users should always be able to check whether they can perform an action +type KubeSelfSubjectAccessReviewProps struct { + // Spec holds information about the request being evaluated. + // + // user and groups must be empty. + Spec *SelfSubjectAccessReviewSpec `field:"required" json:"spec" yaml:"spec"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReview__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReview__checks.go new file mode 100644 index 0000000..9e018f1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReview__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeSelfSubjectAccessReview_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeSelfSubjectAccessReview_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeSelfSubjectAccessReview_ManifestParameters(props *KubeSelfSubjectAccessReviewProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeSelfSubjectAccessReview_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeSelfSubjectAccessReviewParameters(scope constructs.Construct, id *string, props *KubeSelfSubjectAccessReviewProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReview__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReview__no_checks.go new file mode 100644 index 0000000..34cafd6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectAccessReview__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeSelfSubjectAccessReview_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeSelfSubjectAccessReview_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeSelfSubjectAccessReview_ManifestParameters(props *KubeSelfSubjectAccessReviewProps) error { + return nil +} + +func validateKubeSelfSubjectAccessReview_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeSelfSubjectAccessReviewParameters(scope constructs.Construct, id *string, props *KubeSelfSubjectAccessReviewProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReview.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReview.go new file mode 100644 index 0000000..6d86b96 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReview.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. +// +// The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. +type KubeSelfSubjectRulesReview interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeSelfSubjectRulesReview +type jsiiProxy_KubeSelfSubjectRulesReview struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeSelfSubjectRulesReview) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectRulesReview) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectRulesReview) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectRulesReview) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectRulesReview) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectRulesReview) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSelfSubjectRulesReview) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.authorization.v1.SelfSubjectRulesReview" API object. +func NewKubeSelfSubjectRulesReview(scope constructs.Construct, id *string, props *KubeSelfSubjectRulesReviewProps) KubeSelfSubjectRulesReview { + _init_.Initialize() + + if err := validateNewKubeSelfSubjectRulesReviewParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeSelfSubjectRulesReview{} + + _jsii_.Create( + "k8s.KubeSelfSubjectRulesReview", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.authorization.v1.SelfSubjectRulesReview" API object. +func NewKubeSelfSubjectRulesReview_Override(k KubeSelfSubjectRulesReview, scope constructs.Construct, id *string, props *KubeSelfSubjectRulesReviewProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeSelfSubjectRulesReview", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeSelfSubjectRulesReview_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeSelfSubjectRulesReview_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeSelfSubjectRulesReview", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeSelfSubjectRulesReview_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeSelfSubjectRulesReview_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeSelfSubjectRulesReview", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.authorization.v1.SelfSubjectRulesReview". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeSelfSubjectRulesReview_Manifest(props *KubeSelfSubjectRulesReviewProps) interface{} { + _init_.Initialize() + + if err := validateKubeSelfSubjectRulesReview_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeSelfSubjectRulesReview", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeSelfSubjectRulesReview_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeSelfSubjectRulesReview_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeSelfSubjectRulesReview", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeSelfSubjectRulesReview_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeSelfSubjectRulesReview", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeSelfSubjectRulesReview) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeSelfSubjectRulesReview) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeSelfSubjectRulesReview) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeSelfSubjectRulesReview) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReviewProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReviewProps.go new file mode 100644 index 0000000..5853b15 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReviewProps.go @@ -0,0 +1,15 @@ +package k8s + + +// SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. +// +// The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. +type KubeSelfSubjectRulesReviewProps struct { + // Spec holds information about the request being evaluated. + Spec *SelfSubjectRulesReviewSpec `field:"required" json:"spec" yaml:"spec"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReview__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReview__checks.go new file mode 100644 index 0000000..2cf52f9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReview__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeSelfSubjectRulesReview_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeSelfSubjectRulesReview_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeSelfSubjectRulesReview_ManifestParameters(props *KubeSelfSubjectRulesReviewProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeSelfSubjectRulesReview_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeSelfSubjectRulesReviewParameters(scope constructs.Construct, id *string, props *KubeSelfSubjectRulesReviewProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReview__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReview__no_checks.go new file mode 100644 index 0000000..8617c93 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSelfSubjectRulesReview__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeSelfSubjectRulesReview_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeSelfSubjectRulesReview_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeSelfSubjectRulesReview_ManifestParameters(props *KubeSelfSubjectRulesReviewProps) error { + return nil +} + +func validateKubeSelfSubjectRulesReview_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeSelfSubjectRulesReviewParameters(scope constructs.Construct, id *string, props *KubeSelfSubjectRulesReviewProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeService.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeService.go new file mode 100644 index 0000000..cf81594 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeService.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy. +type KubeService interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeService +type jsiiProxy_KubeService struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeService) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeService) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeService) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeService) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeService) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeService) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeService) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.Service" API object. +func NewKubeService(scope constructs.Construct, id *string, props *KubeServiceProps) KubeService { + _init_.Initialize() + + if err := validateNewKubeServiceParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeService{} + + _jsii_.Create( + "k8s.KubeService", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.Service" API object. +func NewKubeService_Override(k KubeService, scope constructs.Construct, id *string, props *KubeServiceProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeService", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeService_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeService_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeService", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeService_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeService_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeService", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.Service". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeService_Manifest(props *KubeServiceProps) interface{} { + _init_.Initialize() + + if err := validateKubeService_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeService", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeService_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeService_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeService", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeService_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeService", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeService) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeService) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeService) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeService) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccount.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccount.go new file mode 100644 index 0000000..82fd85c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccount.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets. +type KubeServiceAccount interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeServiceAccount +type jsiiProxy_KubeServiceAccount struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeServiceAccount) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccount) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccount) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccount) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccount) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccount) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccount) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ServiceAccount" API object. +func NewKubeServiceAccount(scope constructs.Construct, id *string, props *KubeServiceAccountProps) KubeServiceAccount { + _init_.Initialize() + + if err := validateNewKubeServiceAccountParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeServiceAccount{} + + _jsii_.Create( + "k8s.KubeServiceAccount", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ServiceAccount" API object. +func NewKubeServiceAccount_Override(k KubeServiceAccount, scope constructs.Construct, id *string, props *KubeServiceAccountProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeServiceAccount", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeServiceAccount_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeServiceAccount_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeServiceAccount", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeServiceAccount_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeServiceAccount_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeServiceAccount", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ServiceAccount". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeServiceAccount_Manifest(props *KubeServiceAccountProps) interface{} { + _init_.Initialize() + + if err := validateKubeServiceAccount_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeServiceAccount", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeServiceAccount_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeServiceAccount_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeServiceAccount", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeServiceAccount_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeServiceAccount", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeServiceAccount) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeServiceAccount) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeServiceAccount) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeServiceAccount) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountList.go new file mode 100644 index 0000000..b77e8ab --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ServiceAccountList is a list of ServiceAccount objects. +type KubeServiceAccountList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeServiceAccountList +type jsiiProxy_KubeServiceAccountList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeServiceAccountList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccountList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccountList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccountList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccountList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccountList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceAccountList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ServiceAccountList" API object. +func NewKubeServiceAccountList(scope constructs.Construct, id *string, props *KubeServiceAccountListProps) KubeServiceAccountList { + _init_.Initialize() + + if err := validateNewKubeServiceAccountListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeServiceAccountList{} + + _jsii_.Create( + "k8s.KubeServiceAccountList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ServiceAccountList" API object. +func NewKubeServiceAccountList_Override(k KubeServiceAccountList, scope constructs.Construct, id *string, props *KubeServiceAccountListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeServiceAccountList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeServiceAccountList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeServiceAccountList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeServiceAccountList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeServiceAccountList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeServiceAccountList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeServiceAccountList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ServiceAccountList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeServiceAccountList_Manifest(props *KubeServiceAccountListProps) interface{} { + _init_.Initialize() + + if err := validateKubeServiceAccountList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeServiceAccountList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeServiceAccountList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeServiceAccountList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeServiceAccountList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeServiceAccountList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeServiceAccountList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeServiceAccountList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeServiceAccountList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeServiceAccountList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeServiceAccountList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountListProps.go new file mode 100644 index 0000000..2237b29 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountListProps.go @@ -0,0 +1,15 @@ +package k8s + + +// ServiceAccountList is a list of ServiceAccount objects. +type KubeServiceAccountListProps struct { + // List of ServiceAccounts. + // + // More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ + Items *[]*KubeServiceAccountProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountList__checks.go new file mode 100644 index 0000000..b6af31c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeServiceAccountList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeServiceAccountList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeServiceAccountList_ManifestParameters(props *KubeServiceAccountListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeServiceAccountList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeServiceAccountListParameters(scope constructs.Construct, id *string, props *KubeServiceAccountListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountList__no_checks.go new file mode 100644 index 0000000..82df03e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeServiceAccountList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeServiceAccountList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeServiceAccountList_ManifestParameters(props *KubeServiceAccountListProps) error { + return nil +} + +func validateKubeServiceAccountList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeServiceAccountListParameters(scope constructs.Construct, id *string, props *KubeServiceAccountListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountProps.go new file mode 100644 index 0000000..a0037f5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccountProps.go @@ -0,0 +1,23 @@ +package k8s + + +// ServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets. +type KubeServiceAccountProps struct { + // AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. + // + // Can be overridden at the pod level. + AutomountServiceAccountToken *bool `field:"optional" json:"automountServiceAccountToken" yaml:"automountServiceAccountToken"` + // ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. + // + // ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod + ImagePullSecrets *[]*LocalObjectReference `field:"optional" json:"imagePullSecrets" yaml:"imagePullSecrets"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Secrets is a list of the secrets in the same namespace that pods running using this ServiceAccount are allowed to use. + // + // Pods are only limited to this list if this service account has a "kubernetes.io/enforce-mountable-secrets" annotation set to "true". This field should not be used to find auto-generated service account token secrets for use outside of pods. Instead, tokens can be requested directly using the TokenRequest API, or service account token secrets can be manually created. More info: https://kubernetes.io/docs/concepts/configuration/secret + Secrets *[]*ObjectReference `field:"optional" json:"secrets" yaml:"secrets"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccount__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccount__checks.go new file mode 100644 index 0000000..0392ed8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccount__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeServiceAccount_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeServiceAccount_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeServiceAccount_ManifestParameters(props *KubeServiceAccountProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeServiceAccount_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeServiceAccountParameters(scope constructs.Construct, id *string, props *KubeServiceAccountProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccount__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccount__no_checks.go new file mode 100644 index 0000000..5a6b424 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceAccount__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeServiceAccount_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeServiceAccount_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeServiceAccount_ManifestParameters(props *KubeServiceAccountProps) error { + return nil +} + +func validateKubeServiceAccount_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeServiceAccountParameters(scope constructs.Construct, id *string, props *KubeServiceAccountProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceList.go new file mode 100644 index 0000000..7e4e2cf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ServiceList holds a list of services. +type KubeServiceList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeServiceList +type jsiiProxy_KubeServiceList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeServiceList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeServiceList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.core.v1.ServiceList" API object. +func NewKubeServiceList(scope constructs.Construct, id *string, props *KubeServiceListProps) KubeServiceList { + _init_.Initialize() + + if err := validateNewKubeServiceListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeServiceList{} + + _jsii_.Create( + "k8s.KubeServiceList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.core.v1.ServiceList" API object. +func NewKubeServiceList_Override(k KubeServiceList, scope constructs.Construct, id *string, props *KubeServiceListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeServiceList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeServiceList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeServiceList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeServiceList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeServiceList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeServiceList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeServiceList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.core.v1.ServiceList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeServiceList_Manifest(props *KubeServiceListProps) interface{} { + _init_.Initialize() + + if err := validateKubeServiceList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeServiceList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeServiceList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeServiceList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeServiceList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeServiceList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeServiceList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeServiceList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeServiceList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeServiceList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeServiceList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceListProps.go new file mode 100644 index 0000000..774a180 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// ServiceList holds a list of services. +type KubeServiceListProps struct { + // List of services. + Items *[]*KubeServiceProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceList__checks.go new file mode 100644 index 0000000..31b3291 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeServiceList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeServiceList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeServiceList_ManifestParameters(props *KubeServiceListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeServiceList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeServiceListParameters(scope constructs.Construct, id *string, props *KubeServiceListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceList__no_checks.go new file mode 100644 index 0000000..206daf7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeServiceList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeServiceList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeServiceList_ManifestParameters(props *KubeServiceListProps) error { + return nil +} + +func validateKubeServiceList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeServiceListParameters(scope constructs.Construct, id *string, props *KubeServiceListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceProps.go new file mode 100644 index 0000000..000ea7d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeServiceProps.go @@ -0,0 +1,15 @@ +package k8s + + +// Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy. +type KubeServiceProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec defines the behavior of a service. + // + // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *ServiceSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeService__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeService__checks.go new file mode 100644 index 0000000..fc5ca84 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeService__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeService_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeService_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeService_ManifestParameters(props *KubeServiceProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeService_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeServiceParameters(scope constructs.Construct, id *string, props *KubeServiceProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeService__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeService__no_checks.go new file mode 100644 index 0000000..59ce76c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeService__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeService_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeService_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeService_ManifestParameters(props *KubeServiceProps) error { + return nil +} + +func validateKubeService_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeServiceParameters(scope constructs.Construct, id *string, props *KubeServiceProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSet.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSet.go new file mode 100644 index 0000000..f7b5141 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSet.go @@ -0,0 +1,323 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// StatefulSet represents a set of pods with consistent identities. +// +// Identities are defined as: +// - Network: A single stable DNS and hostname. +// - Storage: As many VolumeClaims as requested. +// +// The StatefulSet guarantees that a given network identity will always map to the same storage identity. +type KubeStatefulSet interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeStatefulSet +type jsiiProxy_KubeStatefulSet struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeStatefulSet) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSet) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSet) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSet) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSet) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSet) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSet) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apps.v1.StatefulSet" API object. +func NewKubeStatefulSet(scope constructs.Construct, id *string, props *KubeStatefulSetProps) KubeStatefulSet { + _init_.Initialize() + + if err := validateNewKubeStatefulSetParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeStatefulSet{} + + _jsii_.Create( + "k8s.KubeStatefulSet", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apps.v1.StatefulSet" API object. +func NewKubeStatefulSet_Override(k KubeStatefulSet, scope constructs.Construct, id *string, props *KubeStatefulSetProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeStatefulSet", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeStatefulSet_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStatefulSet_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStatefulSet", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeStatefulSet_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStatefulSet_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStatefulSet", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apps.v1.StatefulSet". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeStatefulSet_Manifest(props *KubeStatefulSetProps) interface{} { + _init_.Initialize() + + if err := validateKubeStatefulSet_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeStatefulSet", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeStatefulSet_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeStatefulSet_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeStatefulSet", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeStatefulSet_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeStatefulSet", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeStatefulSet) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeStatefulSet) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeStatefulSet) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeStatefulSet) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetList.go new file mode 100644 index 0000000..47a6093 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// StatefulSetList is a collection of StatefulSets. +type KubeStatefulSetList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeStatefulSetList +type jsiiProxy_KubeStatefulSetList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeStatefulSetList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSetList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSetList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSetList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSetList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSetList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatefulSetList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apps.v1.StatefulSetList" API object. +func NewKubeStatefulSetList(scope constructs.Construct, id *string, props *KubeStatefulSetListProps) KubeStatefulSetList { + _init_.Initialize() + + if err := validateNewKubeStatefulSetListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeStatefulSetList{} + + _jsii_.Create( + "k8s.KubeStatefulSetList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apps.v1.StatefulSetList" API object. +func NewKubeStatefulSetList_Override(k KubeStatefulSetList, scope constructs.Construct, id *string, props *KubeStatefulSetListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeStatefulSetList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeStatefulSetList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStatefulSetList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStatefulSetList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeStatefulSetList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStatefulSetList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStatefulSetList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apps.v1.StatefulSetList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeStatefulSetList_Manifest(props *KubeStatefulSetListProps) interface{} { + _init_.Initialize() + + if err := validateKubeStatefulSetList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeStatefulSetList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeStatefulSetList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeStatefulSetList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeStatefulSetList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeStatefulSetList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeStatefulSetList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeStatefulSetList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeStatefulSetList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeStatefulSetList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeStatefulSetList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetListProps.go new file mode 100644 index 0000000..1b83124 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// StatefulSetList is a collection of StatefulSets. +type KubeStatefulSetListProps struct { + // Items is the list of stateful sets. + Items *[]*KubeStatefulSetProps `field:"required" json:"items" yaml:"items"` + // Standard list's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetList__checks.go new file mode 100644 index 0000000..258c076 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeStatefulSetList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeStatefulSetList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeStatefulSetList_ManifestParameters(props *KubeStatefulSetListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeStatefulSetList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeStatefulSetListParameters(scope constructs.Construct, id *string, props *KubeStatefulSetListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetList__no_checks.go new file mode 100644 index 0000000..b427fe8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeStatefulSetList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeStatefulSetList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeStatefulSetList_ManifestParameters(props *KubeStatefulSetListProps) error { + return nil +} + +func validateKubeStatefulSetList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeStatefulSetListParameters(scope constructs.Construct, id *string, props *KubeStatefulSetListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetProps.go new file mode 100644 index 0000000..6e5e665 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSetProps.go @@ -0,0 +1,19 @@ +package k8s + + +// StatefulSet represents a set of pods with consistent identities. +// +// Identities are defined as: +// - Network: A single stable DNS and hostname. +// - Storage: As many VolumeClaims as requested. +// +// The StatefulSet guarantees that a given network identity will always map to the same storage identity. +type KubeStatefulSetProps struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Spec defines the desired identities of pods in this set. + Spec *StatefulSetSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSet__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSet__checks.go new file mode 100644 index 0000000..de044d3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSet__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeStatefulSet_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeStatefulSet_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeStatefulSet_ManifestParameters(props *KubeStatefulSetProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeStatefulSet_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeStatefulSetParameters(scope constructs.Construct, id *string, props *KubeStatefulSetProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSet__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSet__no_checks.go new file mode 100644 index 0000000..dd1c848 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatefulSet__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeStatefulSet_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeStatefulSet_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeStatefulSet_ManifestParameters(props *KubeStatefulSetProps) error { + return nil +} + +func validateKubeStatefulSet_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeStatefulSetParameters(scope constructs.Construct, id *string, props *KubeStatefulSetProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatus.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatus.go new file mode 100644 index 0000000..2eb972e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatus.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Status is a return value for calls that don't return other objects. +type KubeStatus interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeStatus +type jsiiProxy_KubeStatus struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeStatus) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatus) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatus) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatus) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatus) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatus) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStatus) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.apimachinery.pkg.apis.meta.v1.Status" API object. +func NewKubeStatus(scope constructs.Construct, id *string, props *KubeStatusProps) KubeStatus { + _init_.Initialize() + + if err := validateNewKubeStatusParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeStatus{} + + _jsii_.Create( + "k8s.KubeStatus", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.apimachinery.pkg.apis.meta.v1.Status" API object. +func NewKubeStatus_Override(k KubeStatus, scope constructs.Construct, id *string, props *KubeStatusProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeStatus", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeStatus_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStatus_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStatus", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeStatus_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStatus_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStatus", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.apimachinery.pkg.apis.meta.v1.Status". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeStatus_Manifest(props *KubeStatusProps) interface{} { + _init_.Initialize() + + if err := validateKubeStatus_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeStatus", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeStatus_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeStatus_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeStatus", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeStatus_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeStatus", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeStatus) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeStatus) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeStatus) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeStatus) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatusProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatusProps.go new file mode 100644 index 0000000..2ce8a86 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatusProps.go @@ -0,0 +1,23 @@ +package k8s + + +// Status is a return value for calls that don't return other objects. +type KubeStatusProps struct { + // Suggested HTTP return code for this status, 0 if not set. + Code *float64 `field:"optional" json:"code" yaml:"code"` + // Extended data associated with the reason. + // + // Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type. + Details *StatusDetails `field:"optional" json:"details" yaml:"details"` + // A human-readable description of the status of this operation. + Message *string `field:"optional" json:"message" yaml:"message"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` + // A machine-readable description of why this operation is in the "Failure" status. + // + // If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it. + Reason *string `field:"optional" json:"reason" yaml:"reason"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatus__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatus__checks.go new file mode 100644 index 0000000..9165c9c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatus__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeStatus_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeStatus_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeStatus_ManifestParameters(props *KubeStatusProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeStatus_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeStatusParameters(scope constructs.Construct, id *string, props *KubeStatusProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStatus__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatus__no_checks.go new file mode 100644 index 0000000..fc92ca2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStatus__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeStatus_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeStatus_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeStatus_ManifestParameters(props *KubeStatusProps) error { + return nil +} + +func validateKubeStatus_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeStatusParameters(scope constructs.Construct, id *string, props *KubeStatusProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClass.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClass.go new file mode 100644 index 0000000..213b3fc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClass.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned. +// +// StorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name. +type KubeStorageClass interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeStorageClass +type jsiiProxy_KubeStorageClass struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeStorageClass) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClass) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClass) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClass) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClass) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClass) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClass) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1.StorageClass" API object. +func NewKubeStorageClass(scope constructs.Construct, id *string, props *KubeStorageClassProps) KubeStorageClass { + _init_.Initialize() + + if err := validateNewKubeStorageClassParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeStorageClass{} + + _jsii_.Create( + "k8s.KubeStorageClass", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1.StorageClass" API object. +func NewKubeStorageClass_Override(k KubeStorageClass, scope constructs.Construct, id *string, props *KubeStorageClassProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeStorageClass", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeStorageClass_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStorageClass_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStorageClass", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeStorageClass_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStorageClass_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStorageClass", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1.StorageClass". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeStorageClass_Manifest(props *KubeStorageClassProps) interface{} { + _init_.Initialize() + + if err := validateKubeStorageClass_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeStorageClass", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeStorageClass_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeStorageClass_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeStorageClass", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeStorageClass_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeStorageClass", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeStorageClass) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeStorageClass) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeStorageClass) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeStorageClass) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassList.go new file mode 100644 index 0000000..670b569 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// StorageClassList is a collection of storage classes. +type KubeStorageClassList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeStorageClassList +type jsiiProxy_KubeStorageClassList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeStorageClassList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClassList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClassList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClassList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClassList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClassList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageClassList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1.StorageClassList" API object. +func NewKubeStorageClassList(scope constructs.Construct, id *string, props *KubeStorageClassListProps) KubeStorageClassList { + _init_.Initialize() + + if err := validateNewKubeStorageClassListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeStorageClassList{} + + _jsii_.Create( + "k8s.KubeStorageClassList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1.StorageClassList" API object. +func NewKubeStorageClassList_Override(k KubeStorageClassList, scope constructs.Construct, id *string, props *KubeStorageClassListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeStorageClassList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeStorageClassList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStorageClassList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStorageClassList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeStorageClassList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStorageClassList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStorageClassList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1.StorageClassList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeStorageClassList_Manifest(props *KubeStorageClassListProps) interface{} { + _init_.Initialize() + + if err := validateKubeStorageClassList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeStorageClassList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeStorageClassList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeStorageClassList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeStorageClassList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeStorageClassList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeStorageClassList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeStorageClassList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeStorageClassList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeStorageClassList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeStorageClassList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassListProps.go new file mode 100644 index 0000000..7dbc3f9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// StorageClassList is a collection of storage classes. +type KubeStorageClassListProps struct { + // Items is the list of StorageClasses. + Items *[]*KubeStorageClassProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassList__checks.go new file mode 100644 index 0000000..488b17a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeStorageClassList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeStorageClassList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeStorageClassList_ManifestParameters(props *KubeStorageClassListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeStorageClassList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeStorageClassListParameters(scope constructs.Construct, id *string, props *KubeStorageClassListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassList__no_checks.go new file mode 100644 index 0000000..de4fb5e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeStorageClassList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeStorageClassList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeStorageClassList_ManifestParameters(props *KubeStorageClassListProps) error { + return nil +} + +func validateKubeStorageClassList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeStorageClassListParameters(scope constructs.Construct, id *string, props *KubeStorageClassListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassProps.go new file mode 100644 index 0000000..0431f25 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClassProps.go @@ -0,0 +1,35 @@ +package k8s + + +// StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned. +// +// StorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name. +type KubeStorageClassProps struct { + // Provisioner indicates the type of the provisioner. + Provisioner *string `field:"required" json:"provisioner" yaml:"provisioner"` + // Restrict the node topologies where volumes can be dynamically provisioned. + // + // Each volume plugin defines its own supported topology specifications. An empty TopologySelectorTerm list means there is no topology restriction. This field is only honored by servers that enable the VolumeScheduling feature. + AllowedTopologies *[]*TopologySelectorTerm `field:"optional" json:"allowedTopologies" yaml:"allowedTopologies"` + // AllowVolumeExpansion shows whether the storage class allow volume expand. + AllowVolumeExpansion *bool `field:"optional" json:"allowVolumeExpansion" yaml:"allowVolumeExpansion"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Dynamically provisioned PersistentVolumes of this storage class are created with these mountOptions, e.g. ["ro", "soft"]. Not validated - mount of the PVs will simply fail if one is invalid. + MountOptions *[]*string `field:"optional" json:"mountOptions" yaml:"mountOptions"` + // Parameters holds the parameters for the provisioner that should create volumes of this storage class. + Parameters *map[string]*string `field:"optional" json:"parameters" yaml:"parameters"` + // Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. + // + // Defaults to Delete. + // Default: Delete. + // + ReclaimPolicy *string `field:"optional" json:"reclaimPolicy" yaml:"reclaimPolicy"` + // VolumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. + // + // When unset, VolumeBindingImmediate is used. This field is only honored by servers that enable the VolumeScheduling feature. + VolumeBindingMode *string `field:"optional" json:"volumeBindingMode" yaml:"volumeBindingMode"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClass__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClass__checks.go new file mode 100644 index 0000000..db7916a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClass__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeStorageClass_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeStorageClass_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeStorageClass_ManifestParameters(props *KubeStorageClassProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeStorageClass_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeStorageClassParameters(scope constructs.Construct, id *string, props *KubeStorageClassProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClass__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClass__no_checks.go new file mode 100644 index 0000000..0496b21 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageClass__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeStorageClass_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeStorageClass_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeStorageClass_ManifestParameters(props *KubeStorageClassProps) error { + return nil +} + +func validateKubeStorageClass_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeStorageClassParameters(scope constructs.Construct, id *string, props *KubeStorageClassProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1.go new file mode 100644 index 0000000..833cba9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// A list of StorageVersions. +type KubeStorageVersionListV1Alpha1 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeStorageVersionListV1Alpha1 +type jsiiProxy_KubeStorageVersionListV1Alpha1 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeStorageVersionListV1Alpha1) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionListV1Alpha1) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionListV1Alpha1) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionListV1Alpha1) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionListV1Alpha1) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionListV1Alpha1) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionListV1Alpha1) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apiserverinternal.v1alpha1.StorageVersionList" API object. +func NewKubeStorageVersionListV1Alpha1(scope constructs.Construct, id *string, props *KubeStorageVersionListV1Alpha1Props) KubeStorageVersionListV1Alpha1 { + _init_.Initialize() + + if err := validateNewKubeStorageVersionListV1Alpha1Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeStorageVersionListV1Alpha1{} + + _jsii_.Create( + "k8s.KubeStorageVersionListV1Alpha1", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apiserverinternal.v1alpha1.StorageVersionList" API object. +func NewKubeStorageVersionListV1Alpha1_Override(k KubeStorageVersionListV1Alpha1, scope constructs.Construct, id *string, props *KubeStorageVersionListV1Alpha1Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeStorageVersionListV1Alpha1", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeStorageVersionListV1Alpha1_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStorageVersionListV1Alpha1_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStorageVersionListV1Alpha1", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeStorageVersionListV1Alpha1_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStorageVersionListV1Alpha1_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStorageVersionListV1Alpha1", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apiserverinternal.v1alpha1.StorageVersionList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeStorageVersionListV1Alpha1_Manifest(props *KubeStorageVersionListV1Alpha1Props) interface{} { + _init_.Initialize() + + if err := validateKubeStorageVersionListV1Alpha1_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeStorageVersionListV1Alpha1", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeStorageVersionListV1Alpha1_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeStorageVersionListV1Alpha1_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeStorageVersionListV1Alpha1", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeStorageVersionListV1Alpha1_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeStorageVersionListV1Alpha1", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeStorageVersionListV1Alpha1) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeStorageVersionListV1Alpha1) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeStorageVersionListV1Alpha1) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeStorageVersionListV1Alpha1) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1Props.go new file mode 100644 index 0000000..7daad05 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1Props.go @@ -0,0 +1,13 @@ +package k8s + + +// A list of StorageVersions. +type KubeStorageVersionListV1Alpha1Props struct { + // Items holds a list of StorageVersion. + Items *[]*KubeStorageVersionV1Alpha1Props `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1__checks.go new file mode 100644 index 0000000..ea6b9a4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeStorageVersionListV1Alpha1_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeStorageVersionListV1Alpha1_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeStorageVersionListV1Alpha1_ManifestParameters(props *KubeStorageVersionListV1Alpha1Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeStorageVersionListV1Alpha1_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeStorageVersionListV1Alpha1Parameters(scope constructs.Construct, id *string, props *KubeStorageVersionListV1Alpha1Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1__no_checks.go new file mode 100644 index 0000000..47b08d3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionListV1Alpha1__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeStorageVersionListV1Alpha1_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeStorageVersionListV1Alpha1_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeStorageVersionListV1Alpha1_ManifestParameters(props *KubeStorageVersionListV1Alpha1Props) error { + return nil +} + +func validateKubeStorageVersionListV1Alpha1_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeStorageVersionListV1Alpha1Parameters(scope constructs.Construct, id *string, props *KubeStorageVersionListV1Alpha1Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1.go new file mode 100644 index 0000000..d50bc35 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// Storage version of a specific resource. +type KubeStorageVersionV1Alpha1 interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeStorageVersionV1Alpha1 +type jsiiProxy_KubeStorageVersionV1Alpha1 struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeStorageVersionV1Alpha1) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionV1Alpha1) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionV1Alpha1) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionV1Alpha1) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionV1Alpha1) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionV1Alpha1) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeStorageVersionV1Alpha1) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.apiserverinternal.v1alpha1.StorageVersion" API object. +func NewKubeStorageVersionV1Alpha1(scope constructs.Construct, id *string, props *KubeStorageVersionV1Alpha1Props) KubeStorageVersionV1Alpha1 { + _init_.Initialize() + + if err := validateNewKubeStorageVersionV1Alpha1Parameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeStorageVersionV1Alpha1{} + + _jsii_.Create( + "k8s.KubeStorageVersionV1Alpha1", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.apiserverinternal.v1alpha1.StorageVersion" API object. +func NewKubeStorageVersionV1Alpha1_Override(k KubeStorageVersionV1Alpha1, scope constructs.Construct, id *string, props *KubeStorageVersionV1Alpha1Props) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeStorageVersionV1Alpha1", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeStorageVersionV1Alpha1_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStorageVersionV1Alpha1_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStorageVersionV1Alpha1", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeStorageVersionV1Alpha1_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeStorageVersionV1Alpha1_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeStorageVersionV1Alpha1", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.apiserverinternal.v1alpha1.StorageVersion". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeStorageVersionV1Alpha1_Manifest(props *KubeStorageVersionV1Alpha1Props) interface{} { + _init_.Initialize() + + if err := validateKubeStorageVersionV1Alpha1_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeStorageVersionV1Alpha1", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeStorageVersionV1Alpha1_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeStorageVersionV1Alpha1_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeStorageVersionV1Alpha1", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeStorageVersionV1Alpha1_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeStorageVersionV1Alpha1", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeStorageVersionV1Alpha1) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeStorageVersionV1Alpha1) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeStorageVersionV1Alpha1) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeStorageVersionV1Alpha1) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1Props.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1Props.go new file mode 100644 index 0000000..4032857 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1Props.go @@ -0,0 +1,13 @@ +package k8s + + +// Storage version of a specific resource. +type KubeStorageVersionV1Alpha1Props struct { + // Spec is an empty spec. + // + // It is here to comply with Kubernetes API style. + Spec interface{} `field:"required" json:"spec" yaml:"spec"` + // The name is .. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1__checks.go new file mode 100644 index 0000000..083ca82 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeStorageVersionV1Alpha1_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeStorageVersionV1Alpha1_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeStorageVersionV1Alpha1_ManifestParameters(props *KubeStorageVersionV1Alpha1Props) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeStorageVersionV1Alpha1_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeStorageVersionV1Alpha1Parameters(scope constructs.Construct, id *string, props *KubeStorageVersionV1Alpha1Props) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1__no_checks.go new file mode 100644 index 0000000..8a62514 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeStorageVersionV1Alpha1__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeStorageVersionV1Alpha1_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeStorageVersionV1Alpha1_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeStorageVersionV1Alpha1_ManifestParameters(props *KubeStorageVersionV1Alpha1Props) error { + return nil +} + +func validateKubeStorageVersionV1Alpha1_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeStorageVersionV1Alpha1Parameters(scope constructs.Construct, id *string, props *KubeStorageVersionV1Alpha1Props) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReview.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReview.go new file mode 100644 index 0000000..836d8e3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReview.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// SubjectAccessReview checks whether or not a user or group can perform an action. +type KubeSubjectAccessReview interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeSubjectAccessReview +type jsiiProxy_KubeSubjectAccessReview struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeSubjectAccessReview) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSubjectAccessReview) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSubjectAccessReview) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSubjectAccessReview) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSubjectAccessReview) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSubjectAccessReview) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeSubjectAccessReview) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.authorization.v1.SubjectAccessReview" API object. +func NewKubeSubjectAccessReview(scope constructs.Construct, id *string, props *KubeSubjectAccessReviewProps) KubeSubjectAccessReview { + _init_.Initialize() + + if err := validateNewKubeSubjectAccessReviewParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeSubjectAccessReview{} + + _jsii_.Create( + "k8s.KubeSubjectAccessReview", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.authorization.v1.SubjectAccessReview" API object. +func NewKubeSubjectAccessReview_Override(k KubeSubjectAccessReview, scope constructs.Construct, id *string, props *KubeSubjectAccessReviewProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeSubjectAccessReview", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeSubjectAccessReview_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeSubjectAccessReview_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeSubjectAccessReview", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeSubjectAccessReview_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeSubjectAccessReview_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeSubjectAccessReview", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.authorization.v1.SubjectAccessReview". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeSubjectAccessReview_Manifest(props *KubeSubjectAccessReviewProps) interface{} { + _init_.Initialize() + + if err := validateKubeSubjectAccessReview_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeSubjectAccessReview", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeSubjectAccessReview_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeSubjectAccessReview_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeSubjectAccessReview", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeSubjectAccessReview_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeSubjectAccessReview", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeSubjectAccessReview) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeSubjectAccessReview) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeSubjectAccessReview) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeSubjectAccessReview) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReviewProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReviewProps.go new file mode 100644 index 0000000..b3a459a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReviewProps.go @@ -0,0 +1,13 @@ +package k8s + + +// SubjectAccessReview checks whether or not a user or group can perform an action. +type KubeSubjectAccessReviewProps struct { + // Spec holds information about the request being evaluated. + Spec *SubjectAccessReviewSpec `field:"required" json:"spec" yaml:"spec"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReview__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReview__checks.go new file mode 100644 index 0000000..ad4561d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReview__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeSubjectAccessReview_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeSubjectAccessReview_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeSubjectAccessReview_ManifestParameters(props *KubeSubjectAccessReviewProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeSubjectAccessReview_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeSubjectAccessReviewParameters(scope constructs.Construct, id *string, props *KubeSubjectAccessReviewProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReview__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReview__no_checks.go new file mode 100644 index 0000000..825b66a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeSubjectAccessReview__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeSubjectAccessReview_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeSubjectAccessReview_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeSubjectAccessReview_ManifestParameters(props *KubeSubjectAccessReviewProps) error { + return nil +} + +func validateKubeSubjectAccessReview_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeSubjectAccessReviewParameters(scope constructs.Construct, id *string, props *KubeSubjectAccessReviewProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequest.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequest.go new file mode 100644 index 0000000..f1f9f04 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequest.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// TokenRequest requests a token for a given service account. +type KubeTokenRequest interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeTokenRequest +type jsiiProxy_KubeTokenRequest struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeTokenRequest) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenRequest) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenRequest) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenRequest) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenRequest) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenRequest) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenRequest) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.authentication.v1.TokenRequest" API object. +func NewKubeTokenRequest(scope constructs.Construct, id *string, props *KubeTokenRequestProps) KubeTokenRequest { + _init_.Initialize() + + if err := validateNewKubeTokenRequestParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeTokenRequest{} + + _jsii_.Create( + "k8s.KubeTokenRequest", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.authentication.v1.TokenRequest" API object. +func NewKubeTokenRequest_Override(k KubeTokenRequest, scope constructs.Construct, id *string, props *KubeTokenRequestProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeTokenRequest", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeTokenRequest_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeTokenRequest_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeTokenRequest", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeTokenRequest_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeTokenRequest_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeTokenRequest", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.authentication.v1.TokenRequest". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeTokenRequest_Manifest(props *KubeTokenRequestProps) interface{} { + _init_.Initialize() + + if err := validateKubeTokenRequest_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeTokenRequest", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeTokenRequest_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeTokenRequest_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeTokenRequest", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeTokenRequest_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeTokenRequest", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeTokenRequest) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeTokenRequest) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeTokenRequest) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeTokenRequest) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequestProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequestProps.go new file mode 100644 index 0000000..d018ce0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequestProps.go @@ -0,0 +1,13 @@ +package k8s + + +// TokenRequest requests a token for a given service account. +type KubeTokenRequestProps struct { + // Spec holds information about the request being evaluated. + Spec *TokenRequestSpec `field:"required" json:"spec" yaml:"spec"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequest__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequest__checks.go new file mode 100644 index 0000000..807c66c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequest__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeTokenRequest_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeTokenRequest_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeTokenRequest_ManifestParameters(props *KubeTokenRequestProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeTokenRequest_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeTokenRequestParameters(scope constructs.Construct, id *string, props *KubeTokenRequestProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequest__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequest__no_checks.go new file mode 100644 index 0000000..6434cbf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenRequest__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeTokenRequest_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeTokenRequest_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeTokenRequest_ManifestParameters(props *KubeTokenRequestProps) error { + return nil +} + +func validateKubeTokenRequest_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeTokenRequestParameters(scope constructs.Construct, id *string, props *KubeTokenRequestProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReview.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReview.go new file mode 100644 index 0000000..0d5b206 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReview.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// TokenReview attempts to authenticate a token to a known user. +// +// Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver. +type KubeTokenReview interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeTokenReview +type jsiiProxy_KubeTokenReview struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeTokenReview) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenReview) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenReview) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenReview) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenReview) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenReview) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeTokenReview) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.authentication.v1.TokenReview" API object. +func NewKubeTokenReview(scope constructs.Construct, id *string, props *KubeTokenReviewProps) KubeTokenReview { + _init_.Initialize() + + if err := validateNewKubeTokenReviewParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeTokenReview{} + + _jsii_.Create( + "k8s.KubeTokenReview", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.authentication.v1.TokenReview" API object. +func NewKubeTokenReview_Override(k KubeTokenReview, scope constructs.Construct, id *string, props *KubeTokenReviewProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeTokenReview", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeTokenReview_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeTokenReview_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeTokenReview", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeTokenReview_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeTokenReview_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeTokenReview", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.authentication.v1.TokenReview". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeTokenReview_Manifest(props *KubeTokenReviewProps) interface{} { + _init_.Initialize() + + if err := validateKubeTokenReview_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeTokenReview", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeTokenReview_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeTokenReview_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeTokenReview", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeTokenReview_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeTokenReview", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeTokenReview) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeTokenReview) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeTokenReview) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeTokenReview) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReviewProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReviewProps.go new file mode 100644 index 0000000..4baf847 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReviewProps.go @@ -0,0 +1,15 @@ +package k8s + + +// TokenReview attempts to authenticate a token to a known user. +// +// Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver. +type KubeTokenReviewProps struct { + // Spec holds information about the request being evaluated. + Spec *TokenReviewSpec `field:"required" json:"spec" yaml:"spec"` + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReview__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReview__checks.go new file mode 100644 index 0000000..2f5538b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReview__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeTokenReview_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeTokenReview_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeTokenReview_ManifestParameters(props *KubeTokenReviewProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeTokenReview_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeTokenReviewParameters(scope constructs.Construct, id *string, props *KubeTokenReviewProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReview__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReview__no_checks.go new file mode 100644 index 0000000..f5232f0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeTokenReview__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeTokenReview_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeTokenReview_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeTokenReview_ManifestParameters(props *KubeTokenReviewProps) error { + return nil +} + +func validateKubeTokenReview_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeTokenReviewParameters(scope constructs.Construct, id *string, props *KubeTokenReviewProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfiguration.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfiguration.go new file mode 100644 index 0000000..e9ba45e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfiguration.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. +type KubeValidatingWebhookConfiguration interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeValidatingWebhookConfiguration +type jsiiProxy_KubeValidatingWebhookConfiguration struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeValidatingWebhookConfiguration) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfiguration) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfiguration) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfiguration) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfiguration) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfiguration) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfiguration) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.admissionregistration.v1.ValidatingWebhookConfiguration" API object. +func NewKubeValidatingWebhookConfiguration(scope constructs.Construct, id *string, props *KubeValidatingWebhookConfigurationProps) KubeValidatingWebhookConfiguration { + _init_.Initialize() + + if err := validateNewKubeValidatingWebhookConfigurationParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeValidatingWebhookConfiguration{} + + _jsii_.Create( + "k8s.KubeValidatingWebhookConfiguration", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.admissionregistration.v1.ValidatingWebhookConfiguration" API object. +func NewKubeValidatingWebhookConfiguration_Override(k KubeValidatingWebhookConfiguration, scope constructs.Construct, id *string, props *KubeValidatingWebhookConfigurationProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeValidatingWebhookConfiguration", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeValidatingWebhookConfiguration_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeValidatingWebhookConfiguration_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeValidatingWebhookConfiguration", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeValidatingWebhookConfiguration_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeValidatingWebhookConfiguration_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeValidatingWebhookConfiguration", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.admissionregistration.v1.ValidatingWebhookConfiguration". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeValidatingWebhookConfiguration_Manifest(props *KubeValidatingWebhookConfigurationProps) interface{} { + _init_.Initialize() + + if err := validateKubeValidatingWebhookConfiguration_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeValidatingWebhookConfiguration", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeValidatingWebhookConfiguration_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeValidatingWebhookConfiguration_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeValidatingWebhookConfiguration", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeValidatingWebhookConfiguration_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeValidatingWebhookConfiguration", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeValidatingWebhookConfiguration) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeValidatingWebhookConfiguration) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeValidatingWebhookConfiguration) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeValidatingWebhookConfiguration) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationList.go new file mode 100644 index 0000000..a423b7c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration. +type KubeValidatingWebhookConfigurationList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeValidatingWebhookConfigurationList +type jsiiProxy_KubeValidatingWebhookConfigurationList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeValidatingWebhookConfigurationList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfigurationList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfigurationList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfigurationList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfigurationList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfigurationList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeValidatingWebhookConfigurationList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.admissionregistration.v1.ValidatingWebhookConfigurationList" API object. +func NewKubeValidatingWebhookConfigurationList(scope constructs.Construct, id *string, props *KubeValidatingWebhookConfigurationListProps) KubeValidatingWebhookConfigurationList { + _init_.Initialize() + + if err := validateNewKubeValidatingWebhookConfigurationListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeValidatingWebhookConfigurationList{} + + _jsii_.Create( + "k8s.KubeValidatingWebhookConfigurationList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.admissionregistration.v1.ValidatingWebhookConfigurationList" API object. +func NewKubeValidatingWebhookConfigurationList_Override(k KubeValidatingWebhookConfigurationList, scope constructs.Construct, id *string, props *KubeValidatingWebhookConfigurationListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeValidatingWebhookConfigurationList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeValidatingWebhookConfigurationList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeValidatingWebhookConfigurationList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeValidatingWebhookConfigurationList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeValidatingWebhookConfigurationList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeValidatingWebhookConfigurationList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeValidatingWebhookConfigurationList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.admissionregistration.v1.ValidatingWebhookConfigurationList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeValidatingWebhookConfigurationList_Manifest(props *KubeValidatingWebhookConfigurationListProps) interface{} { + _init_.Initialize() + + if err := validateKubeValidatingWebhookConfigurationList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeValidatingWebhookConfigurationList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeValidatingWebhookConfigurationList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeValidatingWebhookConfigurationList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeValidatingWebhookConfigurationList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeValidatingWebhookConfigurationList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeValidatingWebhookConfigurationList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeValidatingWebhookConfigurationList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeValidatingWebhookConfigurationList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeValidatingWebhookConfigurationList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeValidatingWebhookConfigurationList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationListProps.go new file mode 100644 index 0000000..08016dc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationListProps.go @@ -0,0 +1,13 @@ +package k8s + + +// ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration. +type KubeValidatingWebhookConfigurationListProps struct { + // List of ValidatingWebhookConfiguration. + Items *[]*KubeValidatingWebhookConfigurationProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationList__checks.go new file mode 100644 index 0000000..b19978a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeValidatingWebhookConfigurationList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeValidatingWebhookConfigurationList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeValidatingWebhookConfigurationList_ManifestParameters(props *KubeValidatingWebhookConfigurationListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeValidatingWebhookConfigurationList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeValidatingWebhookConfigurationListParameters(scope constructs.Construct, id *string, props *KubeValidatingWebhookConfigurationListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationList__no_checks.go new file mode 100644 index 0000000..b713505 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeValidatingWebhookConfigurationList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeValidatingWebhookConfigurationList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeValidatingWebhookConfigurationList_ManifestParameters(props *KubeValidatingWebhookConfigurationListProps) error { + return nil +} + +func validateKubeValidatingWebhookConfigurationList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeValidatingWebhookConfigurationListParameters(scope constructs.Construct, id *string, props *KubeValidatingWebhookConfigurationListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationProps.go new file mode 100644 index 0000000..0b26037 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfigurationProps.go @@ -0,0 +1,13 @@ +package k8s + + +// ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. +type KubeValidatingWebhookConfigurationProps struct { + // Standard object metadata; + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Webhooks is a list of webhooks and the affected resources and operations. + Webhooks *[]*ValidatingWebhook `field:"optional" json:"webhooks" yaml:"webhooks"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfiguration__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfiguration__checks.go new file mode 100644 index 0000000..8d62ac5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfiguration__checks.go @@ -0,0 +1,60 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeValidatingWebhookConfiguration_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeValidatingWebhookConfiguration_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeValidatingWebhookConfiguration_ManifestParameters(props *KubeValidatingWebhookConfigurationProps) error { + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeValidatingWebhookConfiguration_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeValidatingWebhookConfigurationParameters(scope constructs.Construct, id *string, props *KubeValidatingWebhookConfigurationProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfiguration__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfiguration__no_checks.go new file mode 100644 index 0000000..0513253 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeValidatingWebhookConfiguration__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeValidatingWebhookConfiguration_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeValidatingWebhookConfiguration_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeValidatingWebhookConfiguration_ManifestParameters(props *KubeValidatingWebhookConfigurationProps) error { + return nil +} + +func validateKubeValidatingWebhookConfiguration_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeValidatingWebhookConfigurationParameters(scope constructs.Construct, id *string, props *KubeValidatingWebhookConfigurationProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachment.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachment.go new file mode 100644 index 0000000..dd55d59 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachment.go @@ -0,0 +1,319 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node. +// +// VolumeAttachment objects are non-namespaced. +type KubeVolumeAttachment interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeVolumeAttachment +type jsiiProxy_KubeVolumeAttachment struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeVolumeAttachment) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachment) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachment) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachment) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachment) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachment) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachment) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1.VolumeAttachment" API object. +func NewKubeVolumeAttachment(scope constructs.Construct, id *string, props *KubeVolumeAttachmentProps) KubeVolumeAttachment { + _init_.Initialize() + + if err := validateNewKubeVolumeAttachmentParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeVolumeAttachment{} + + _jsii_.Create( + "k8s.KubeVolumeAttachment", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1.VolumeAttachment" API object. +func NewKubeVolumeAttachment_Override(k KubeVolumeAttachment, scope constructs.Construct, id *string, props *KubeVolumeAttachmentProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeVolumeAttachment", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeVolumeAttachment_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeVolumeAttachment_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeVolumeAttachment", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeVolumeAttachment_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeVolumeAttachment_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeVolumeAttachment", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1.VolumeAttachment". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeVolumeAttachment_Manifest(props *KubeVolumeAttachmentProps) interface{} { + _init_.Initialize() + + if err := validateKubeVolumeAttachment_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeVolumeAttachment", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeVolumeAttachment_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeVolumeAttachment_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeVolumeAttachment", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeVolumeAttachment_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeVolumeAttachment", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeVolumeAttachment) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeVolumeAttachment) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeVolumeAttachment) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeVolumeAttachment) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentList.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentList.go new file mode 100644 index 0000000..c99070c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentList.go @@ -0,0 +1,317 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "example.com/cdk8s-test/imports/k8s/internal" + "github.com/aws/constructs-go/constructs/v10" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +// VolumeAttachmentList is a collection of VolumeAttachment objects. +type KubeVolumeAttachmentList interface { + cdk8s.ApiObject + // The group portion of the API version (e.g. `authorization.k8s.io`). + ApiGroup() *string + // The object's API version (e.g. `authorization.k8s.io/v1`). + ApiVersion() *string + // The chart in which this object is defined. + Chart() cdk8s.Chart + // The object kind. + Kind() *string + // Metadata associated with this API object. + Metadata() cdk8s.ApiObjectMetadataDefinition + // The name of the API object. + // + // If a name is specified in `metadata.name` this will be the name returned. + // Otherwise, a name will be generated by calling + // `Chart.of(this).generatedObjectName(this)`, which by default uses the + // construct path to generate a DNS-compatible name for the resource. + Name() *string + // The tree node. + Node() constructs.Node + // Create a dependency between this ApiObject and other constructs. + // + // These can be other ApiObjects, Charts, or custom. + AddDependency(dependencies ...constructs.IConstruct) + // Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object. + // + // Example: + // kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true)); + // + AddJsonPatch(ops ...cdk8s.JsonPatch) + // Renders the object to Kubernetes JSON. + ToJson() interface{} + // Returns a string representation of this construct. + ToString() *string +} + +// The jsii proxy struct for KubeVolumeAttachmentList +type jsiiProxy_KubeVolumeAttachmentList struct { + internal.Type__cdk8sApiObject +} + +func (j *jsiiProxy_KubeVolumeAttachmentList) ApiGroup() *string { + var returns *string + _jsii_.Get( + j, + "apiGroup", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachmentList) ApiVersion() *string { + var returns *string + _jsii_.Get( + j, + "apiVersion", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachmentList) Chart() cdk8s.Chart { + var returns cdk8s.Chart + _jsii_.Get( + j, + "chart", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachmentList) Kind() *string { + var returns *string + _jsii_.Get( + j, + "kind", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachmentList) Metadata() cdk8s.ApiObjectMetadataDefinition { + var returns cdk8s.ApiObjectMetadataDefinition + _jsii_.Get( + j, + "metadata", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachmentList) Name() *string { + var returns *string + _jsii_.Get( + j, + "name", + &returns, + ) + return returns +} + +func (j *jsiiProxy_KubeVolumeAttachmentList) Node() constructs.Node { + var returns constructs.Node + _jsii_.Get( + j, + "node", + &returns, + ) + return returns +} + + +// Defines a "io.k8s.api.storage.v1.VolumeAttachmentList" API object. +func NewKubeVolumeAttachmentList(scope constructs.Construct, id *string, props *KubeVolumeAttachmentListProps) KubeVolumeAttachmentList { + _init_.Initialize() + + if err := validateNewKubeVolumeAttachmentListParameters(scope, id, props); err != nil { + panic(err) + } + j := jsiiProxy_KubeVolumeAttachmentList{} + + _jsii_.Create( + "k8s.KubeVolumeAttachmentList", + []interface{}{scope, id, props}, + &j, + ) + + return &j +} + +// Defines a "io.k8s.api.storage.v1.VolumeAttachmentList" API object. +func NewKubeVolumeAttachmentList_Override(k KubeVolumeAttachmentList, scope constructs.Construct, id *string, props *KubeVolumeAttachmentListProps) { + _init_.Initialize() + + _jsii_.Create( + "k8s.KubeVolumeAttachmentList", + []interface{}{scope, id, props}, + k, + ) +} + +// Return whether the given object is an `ApiObject`. +// +// We do attribute detection since we can't reliably use 'instanceof'. +func KubeVolumeAttachmentList_IsApiObject(o interface{}) *bool { + _init_.Initialize() + + if err := validateKubeVolumeAttachmentList_IsApiObjectParameters(o); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeVolumeAttachmentList", + "isApiObject", + []interface{}{o}, + &returns, + ) + + return returns +} + +// Checks if `x` is a construct. +// +// Use this method instead of `instanceof` to properly detect `Construct` +// instances, even when the construct library is symlinked. +// +// Explanation: in JavaScript, multiple copies of the `constructs` library on +// disk are seen as independent, completely different libraries. As a +// consequence, the class `Construct` in each copy of the `constructs` library +// is seen as a different class, and an instance of one class will not test as +// `instanceof` the other class. `npm install` will not create installations +// like this, but users may manually symlink construct libraries together or +// use a monorepo tool: in those cases, multiple copies of the `constructs` +// library can be accidentally installed, and `instanceof` will behave +// unpredictably. It is safest to avoid using `instanceof`, and using +// this type-testing method instead. +// +// Returns: true if `x` is an object created from a class which extends `Construct`. +func KubeVolumeAttachmentList_IsConstruct(x interface{}) *bool { + _init_.Initialize() + + if err := validateKubeVolumeAttachmentList_IsConstructParameters(x); err != nil { + panic(err) + } + var returns *bool + + _jsii_.StaticInvoke( + "k8s.KubeVolumeAttachmentList", + "isConstruct", + []interface{}{x}, + &returns, + ) + + return returns +} + +// Renders a Kubernetes manifest for "io.k8s.api.storage.v1.VolumeAttachmentList". +// +// This can be used to inline resource manifests inside other objects (e.g. as templates). +func KubeVolumeAttachmentList_Manifest(props *KubeVolumeAttachmentListProps) interface{} { + _init_.Initialize() + + if err := validateKubeVolumeAttachmentList_ManifestParameters(props); err != nil { + panic(err) + } + var returns interface{} + + _jsii_.StaticInvoke( + "k8s.KubeVolumeAttachmentList", + "manifest", + []interface{}{props}, + &returns, + ) + + return returns +} + +// Returns the `ApiObject` named `Resource` which is a child of the given construct. +// +// If `c` is an `ApiObject`, it is returned directly. Throws an +// exception if the construct does not have a child named `Default` _or_ if +// this child is not an `ApiObject`. +func KubeVolumeAttachmentList_Of(c constructs.IConstruct) cdk8s.ApiObject { + _init_.Initialize() + + if err := validateKubeVolumeAttachmentList_OfParameters(c); err != nil { + panic(err) + } + var returns cdk8s.ApiObject + + _jsii_.StaticInvoke( + "k8s.KubeVolumeAttachmentList", + "of", + []interface{}{c}, + &returns, + ) + + return returns +} + +func KubeVolumeAttachmentList_GVK() *cdk8s.GroupVersionKind { + _init_.Initialize() + var returns *cdk8s.GroupVersionKind + _jsii_.StaticGet( + "k8s.KubeVolumeAttachmentList", + "GVK", + &returns, + ) + return returns +} + +func (k *jsiiProxy_KubeVolumeAttachmentList) AddDependency(dependencies ...constructs.IConstruct) { + args := []interface{}{} + for _, a := range dependencies { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addDependency", + args, + ) +} + +func (k *jsiiProxy_KubeVolumeAttachmentList) AddJsonPatch(ops ...cdk8s.JsonPatch) { + args := []interface{}{} + for _, a := range ops { + args = append(args, a) + } + + _jsii_.InvokeVoid( + k, + "addJsonPatch", + args, + ) +} + +func (k *jsiiProxy_KubeVolumeAttachmentList) ToJson() interface{} { + var returns interface{} + + _jsii_.Invoke( + k, + "toJson", + nil, // no parameters + &returns, + ) + + return returns +} + +func (k *jsiiProxy_KubeVolumeAttachmentList) ToString() *string { + var returns *string + + _jsii_.Invoke( + k, + "toString", + nil, // no parameters + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentListProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentListProps.go new file mode 100644 index 0000000..ff4511c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentListProps.go @@ -0,0 +1,11 @@ +package k8s + + +// VolumeAttachmentList is a collection of VolumeAttachment objects. +type KubeVolumeAttachmentListProps struct { + // Items is the list of VolumeAttachments. + Items *[]*KubeVolumeAttachmentProps `field:"required" json:"items" yaml:"items"` + // Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + Metadata *ListMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentList__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentList__checks.go new file mode 100644 index 0000000..43e23fb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentList__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeVolumeAttachmentList_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeVolumeAttachmentList_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeVolumeAttachmentList_ManifestParameters(props *KubeVolumeAttachmentListProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeVolumeAttachmentList_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeVolumeAttachmentListParameters(scope constructs.Construct, id *string, props *KubeVolumeAttachmentListProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentList__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentList__no_checks.go new file mode 100644 index 0000000..c57023f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentList__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeVolumeAttachmentList_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeVolumeAttachmentList_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeVolumeAttachmentList_ManifestParameters(props *KubeVolumeAttachmentListProps) error { + return nil +} + +func validateKubeVolumeAttachmentList_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeVolumeAttachmentListParameters(scope constructs.Construct, id *string, props *KubeVolumeAttachmentListProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentProps.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentProps.go new file mode 100644 index 0000000..d1afa58 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachmentProps.go @@ -0,0 +1,17 @@ +package k8s + + +// VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node. +// +// VolumeAttachment objects are non-namespaced. +type KubeVolumeAttachmentProps struct { + // Specification of the desired attach/detach volume behavior. + // + // Populated by the Kubernetes system. + Spec *VolumeAttachmentSpec `field:"required" json:"spec" yaml:"spec"` + // Standard object metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachment__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachment__checks.go new file mode 100644 index 0000000..1ecb4b1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachment__checks.go @@ -0,0 +1,66 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + "github.com/aws/constructs-go/constructs/v10" +) + +func validateKubeVolumeAttachment_IsApiObjectParameters(o interface{}) error { + if o == nil { + return fmt.Errorf("parameter o is required, but nil was provided") + } + + return nil +} + +func validateKubeVolumeAttachment_IsConstructParameters(x interface{}) error { + if x == nil { + return fmt.Errorf("parameter x is required, but nil was provided") + } + + return nil +} + +func validateKubeVolumeAttachment_ManifestParameters(props *KubeVolumeAttachmentProps) error { + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + +func validateKubeVolumeAttachment_OfParameters(c constructs.IConstruct) error { + if c == nil { + return fmt.Errorf("parameter c is required, but nil was provided") + } + + return nil +} + +func validateNewKubeVolumeAttachmentParameters(scope constructs.Construct, id *string, props *KubeVolumeAttachmentProps) error { + if scope == nil { + return fmt.Errorf("parameter scope is required, but nil was provided") + } + + if id == nil { + return fmt.Errorf("parameter id is required, but nil was provided") + } + + if props == nil { + return fmt.Errorf("parameter props is required, but nil was provided") + } + if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { + return err + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachment__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachment__no_checks.go new file mode 100644 index 0000000..6314260 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/KubeVolumeAttachment__no_checks.go @@ -0,0 +1,26 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateKubeVolumeAttachment_IsApiObjectParameters(o interface{}) error { + return nil +} + +func validateKubeVolumeAttachment_IsConstructParameters(x interface{}) error { + return nil +} + +func validateKubeVolumeAttachment_ManifestParameters(props *KubeVolumeAttachmentProps) error { + return nil +} + +func validateKubeVolumeAttachment_OfParameters(c constructs.IConstruct) error { + return nil +} + +func validateNewKubeVolumeAttachmentParameters(scope constructs.Construct, id *string, props *KubeVolumeAttachmentProps) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LabelSelector.go b/examples/cdk8s-sample-deployment/imports/k8s/LabelSelector.go new file mode 100644 index 0000000..c1a7d1b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LabelSelector.go @@ -0,0 +1,17 @@ +package k8s + + +// A label selector is a label query over a set of resources. +// +// The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. +type LabelSelector struct { + // matchExpressions is a list of label selector requirements. + // + // The requirements are ANDed. + MatchExpressions *[]*LabelSelectorRequirement `field:"optional" json:"matchExpressions" yaml:"matchExpressions"` + // matchLabels is a map of {key,value} pairs. + // + // A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + MatchLabels *map[string]*string `field:"optional" json:"matchLabels" yaml:"matchLabels"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LabelSelectorRequirement.go b/examples/cdk8s-sample-deployment/imports/k8s/LabelSelectorRequirement.go new file mode 100644 index 0000000..778a875 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LabelSelectorRequirement.go @@ -0,0 +1,17 @@ +package k8s + + +// A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. +type LabelSelectorRequirement struct { + // key is the label key that the selector applies to. + Key *string `field:"required" json:"key" yaml:"key"` + // operator represents a key's relationship to a set of values. + // + // Valid operators are In, NotIn, Exists and DoesNotExist. + Operator *string `field:"required" json:"operator" yaml:"operator"` + // values is an array of string values. + // + // If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + Values *[]*string `field:"optional" json:"values" yaml:"values"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LeaseSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/LeaseSpec.go new file mode 100644 index 0000000..6ecf13a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LeaseSpec.go @@ -0,0 +1,22 @@ +package k8s + +import ( + "time" +) + +// LeaseSpec is a specification of a Lease. +type LeaseSpec struct { + // acquireTime is a time when the current lease was acquired. + AcquireTime *time.Time `field:"optional" json:"acquireTime" yaml:"acquireTime"` + // holderIdentity contains the identity of the holder of a current lease. + HolderIdentity *string `field:"optional" json:"holderIdentity" yaml:"holderIdentity"` + // leaseDurationSeconds is a duration that candidates for a lease need to wait to force acquire it. + // + // This is measure against time of last observed RenewTime. + LeaseDurationSeconds *float64 `field:"optional" json:"leaseDurationSeconds" yaml:"leaseDurationSeconds"` + // leaseTransitions is the number of transitions of a lease between holders. + LeaseTransitions *float64 `field:"optional" json:"leaseTransitions" yaml:"leaseTransitions"` + // renewTime is a time when the current holder of a lease has last updated the lease. + RenewTime *time.Time `field:"optional" json:"renewTime" yaml:"renewTime"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Lifecycle.go b/examples/cdk8s-sample-deployment/imports/k8s/Lifecycle.go new file mode 100644 index 0000000..bfb8a93 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Lifecycle.go @@ -0,0 +1,17 @@ +package k8s + + +// Lifecycle describes actions that the management system should take in response to container lifecycle events. +// +// For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted. +type Lifecycle struct { + // PostStart is called immediately after a container is created. + // + // If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks + PostStart *LifecycleHandler `field:"optional" json:"postStart" yaml:"postStart"` + // PreStop is called immediately before a container is terminated due to an API request or management event such as liveness/startup probe failure, preemption, resource contention, etc. + // + // The handler is not called if the container crashes or exits. The Pod's termination grace period countdown begins before the PreStop hook is executed. Regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period (unless delayed by finalizers). Other management of the container blocks until the hook completes or until the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks + PreStop *LifecycleHandler `field:"optional" json:"preStop" yaml:"preStop"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LifecycleHandler.go b/examples/cdk8s-sample-deployment/imports/k8s/LifecycleHandler.go new file mode 100644 index 0000000..b84bbec --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LifecycleHandler.go @@ -0,0 +1,17 @@ +package k8s + + +// LifecycleHandler defines a specific action that should be taken in a lifecycle hook. +// +// One and only one of the fields, except TCPSocket must be specified. +type LifecycleHandler struct { + // Exec specifies the action to take. + Exec *ExecAction `field:"optional" json:"exec" yaml:"exec"` + // HTTPGet specifies the http request to perform. + HttpGet *HttpGetAction `field:"optional" json:"httpGet" yaml:"httpGet"` + // Deprecated. + // + // TCPSocket is NOT supported as a LifecycleHandler and kept for the backward compatibility. There are no validation of this field and lifecycle hooks will fail in runtime when tcp handler is specified. + TcpSocket *TcpSocketAction `field:"optional" json:"tcpSocket" yaml:"tcpSocket"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LimitRangeItem.go b/examples/cdk8s-sample-deployment/imports/k8s/LimitRangeItem.go new file mode 100644 index 0000000..a1440b3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LimitRangeItem.go @@ -0,0 +1,21 @@ +package k8s + + +// LimitRangeItem defines a min/max usage limit for any resource that matches on kind. +type LimitRangeItem struct { + // Type of resource that this limit applies to. + Type *string `field:"required" json:"type" yaml:"type"` + // Default resource requirement limit value by resource name if resource limit is omitted. + Default *map[string]Quantity `field:"optional" json:"default" yaml:"default"` + // DefaultRequest is the default resource requirement request value by resource name if resource request is omitted. + DefaultRequest *map[string]Quantity `field:"optional" json:"defaultRequest" yaml:"defaultRequest"` + // Max usage constraints on this kind by resource name. + Max *map[string]Quantity `field:"optional" json:"max" yaml:"max"` + // MaxLimitRequestRatio if specified, the named resource must have a request and limit that are both non-zero where limit divided by request is less than or equal to the enumerated value; + // + // this represents the max burst for the named resource. + MaxLimitRequestRatio *map[string]Quantity `field:"optional" json:"maxLimitRequestRatio" yaml:"maxLimitRequestRatio"` + // Min usage constraints on this kind by resource name. + Min *map[string]Quantity `field:"optional" json:"min" yaml:"min"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LimitRangeSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/LimitRangeSpec.go new file mode 100644 index 0000000..2050c15 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LimitRangeSpec.go @@ -0,0 +1,9 @@ +package k8s + + +// LimitRangeSpec defines a min/max usage limit for resources that match on kind. +type LimitRangeSpec struct { + // Limits is the list of LimitRangeItem objects that are enforced. + Limits *[]*LimitRangeItem `field:"required" json:"limits" yaml:"limits"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LimitResponseV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/LimitResponseV1Beta1.go new file mode 100644 index 0000000..5d298aa --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LimitResponseV1Beta1.go @@ -0,0 +1,15 @@ +package k8s + + +// LimitResponse defines how to handle requests that can not be executed right now. +type LimitResponseV1Beta1 struct { + // `type` is "Queue" or "Reject". + // + // "Queue" means that requests that can not be executed upon arrival are held in a queue until they can be executed or a queuing limit is reached. "Reject" means that requests that can not be executed upon arrival are rejected. Required. + Type *string `field:"required" json:"type" yaml:"type"` + // `queuing` holds the configuration parameters for queuing. + // + // This field may be non-empty only if `type` is `"Queue"`. + Queuing *QueuingConfigurationV1Beta1 `field:"optional" json:"queuing" yaml:"queuing"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LimitResponseV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/LimitResponseV1Beta2.go new file mode 100644 index 0000000..ec79cf3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LimitResponseV1Beta2.go @@ -0,0 +1,15 @@ +package k8s + + +// LimitResponse defines how to handle requests that can not be executed right now. +type LimitResponseV1Beta2 struct { + // `type` is "Queue" or "Reject". + // + // "Queue" means that requests that can not be executed upon arrival are held in a queue until they can be executed or a queuing limit is reached. "Reject" means that requests that can not be executed upon arrival are rejected. Required. + Type *string `field:"required" json:"type" yaml:"type"` + // `queuing` holds the configuration parameters for queuing. + // + // This field may be non-empty only if `type` is `"Queue"`. + Queuing *QueuingConfigurationV1Beta2 `field:"optional" json:"queuing" yaml:"queuing"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LimitedPriorityLevelConfigurationV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/LimitedPriorityLevelConfigurationV1Beta1.go new file mode 100644 index 0000000..79efbfc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LimitedPriorityLevelConfigurationV1Beta1.go @@ -0,0 +1,21 @@ +package k8s + + +// LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. +// +// It addresses two issues: +// - How are requests for this priority level limited? +// - What should be done with requests that exceed the limit? +type LimitedPriorityLevelConfigurationV1Beta1 struct { + // `assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. + // + // ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) --- the number of requests that may be executing at a time --- for each such priority level: + // + // ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) ) + // + // bigger numbers of ACS mean more reserved concurrent requests (at the expense of every other PL). This field has a default value of 30. + AssuredConcurrencyShares *float64 `field:"optional" json:"assuredConcurrencyShares" yaml:"assuredConcurrencyShares"` + // `limitResponse` indicates what to do with requests that can not be executed right now. + LimitResponse *LimitResponseV1Beta1 `field:"optional" json:"limitResponse" yaml:"limitResponse"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LimitedPriorityLevelConfigurationV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/LimitedPriorityLevelConfigurationV1Beta2.go new file mode 100644 index 0000000..36480fa --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LimitedPriorityLevelConfigurationV1Beta2.go @@ -0,0 +1,21 @@ +package k8s + + +// LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. +// +// It addresses two issues: +// - How are requests for this priority level limited? +// - What should be done with requests that exceed the limit? +type LimitedPriorityLevelConfigurationV1Beta2 struct { + // `assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. + // + // ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) --- the number of requests that may be executing at a time --- for each such priority level: + // + // ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) ) + // + // bigger numbers of ACS mean more reserved concurrent requests (at the expense of every other PL). This field has a default value of 30. + AssuredConcurrencyShares *float64 `field:"optional" json:"assuredConcurrencyShares" yaml:"assuredConcurrencyShares"` + // `limitResponse` indicates what to do with requests that can not be executed right now. + LimitResponse *LimitResponseV1Beta2 `field:"optional" json:"limitResponse" yaml:"limitResponse"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ListMeta.go b/examples/cdk8s-sample-deployment/imports/k8s/ListMeta.go new file mode 100644 index 0000000..0e1ab21 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ListMeta.go @@ -0,0 +1,23 @@ +package k8s + + +// ListMeta describes metadata that synthetic resources must have, including lists and various status objects. +// +// A resource may have only one of {ObjectMeta, ListMeta}. +type ListMeta struct { + // continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. + // + // The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message. + Continue *string `field:"optional" json:"continue" yaml:"continue"` + // remainingItemCount is the number of subsequent items in the list which are not included in this list response. + // + // If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact. + RemainingItemCount *float64 `field:"optional" json:"remainingItemCount" yaml:"remainingItemCount"` + // String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. + // + // Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + ResourceVersion *string `field:"optional" json:"resourceVersion" yaml:"resourceVersion"` + // Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + SelfLink *string `field:"optional" json:"selfLink" yaml:"selfLink"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LocalObjectReference.go b/examples/cdk8s-sample-deployment/imports/k8s/LocalObjectReference.go new file mode 100644 index 0000000..d0d797e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LocalObjectReference.go @@ -0,0 +1,11 @@ +package k8s + + +// LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace. +type LocalObjectReference struct { + // Name of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `field:"optional" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/LocalVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/LocalVolumeSource.go new file mode 100644 index 0000000..cbb3c5f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/LocalVolumeSource.go @@ -0,0 +1,15 @@ +package k8s + + +// Local represents directly-attached storage with node affinity (Beta feature). +type LocalVolumeSource struct { + // path of the full path to the volume on the node. + // + // It can be either a directory or block device (disk, partition, ...). + Path *string `field:"required" json:"path" yaml:"path"` + // fsType is the filesystem type to mount. + // + // It applies only when the Path is a block device. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default value is to auto-select a filesystem if unspecified. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ManagedFieldsEntry.go b/examples/cdk8s-sample-deployment/imports/k8s/ManagedFieldsEntry.go new file mode 100644 index 0000000..46bbaed --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ManagedFieldsEntry.go @@ -0,0 +1,34 @@ +package k8s + +import ( + "time" +) + +// ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to. +type ManagedFieldsEntry struct { + // APIVersion defines the version of this resource that this field set applies to. + // + // The format is "group/version" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted. + ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"` + // FieldsType is the discriminator for the different fields format and version. + // + // There is currently only one possible value: "FieldsV1". + FieldsType *string `field:"optional" json:"fieldsType" yaml:"fieldsType"` + // FieldsV1 holds the first JSON version format as described in the "FieldsV1" type. + FieldsV1 interface{} `field:"optional" json:"fieldsV1" yaml:"fieldsV1"` + // Manager is an identifier of the workflow managing these fields. + Manager *string `field:"optional" json:"manager" yaml:"manager"` + // Operation is the type of operation which lead to this ManagedFieldsEntry being created. + // + // The only valid values for this field are 'Apply' and 'Update'. + Operation *string `field:"optional" json:"operation" yaml:"operation"` + // Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. + // + // The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource. + Subresource *string `field:"optional" json:"subresource" yaml:"subresource"` + // Time is the timestamp of when the ManagedFields entry was added. + // + // The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over. + Time *time.Time `field:"optional" json:"time" yaml:"time"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/MetricIdentifierV2.go b/examples/cdk8s-sample-deployment/imports/k8s/MetricIdentifierV2.go new file mode 100644 index 0000000..19109d7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/MetricIdentifierV2.go @@ -0,0 +1,13 @@ +package k8s + + +// MetricIdentifier defines the name and optionally selector for a metric. +type MetricIdentifierV2 struct { + // name is the name of the given metric. + Name *string `field:"required" json:"name" yaml:"name"` + // selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. + // + // When unset, just the metricName will be used to gather metrics. + Selector *LabelSelector `field:"optional" json:"selector" yaml:"selector"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/MetricIdentifierV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/MetricIdentifierV2Beta2.go new file mode 100644 index 0000000..965e6f6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/MetricIdentifierV2Beta2.go @@ -0,0 +1,13 @@ +package k8s + + +// MetricIdentifier defines the name and optionally selector for a metric. +type MetricIdentifierV2Beta2 struct { + // name is the name of the given metric. + Name *string `field:"required" json:"name" yaml:"name"` + // selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. + // + // When unset, just the metricName will be used to gather metrics. + Selector *LabelSelector `field:"optional" json:"selector" yaml:"selector"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/MetricSpecV2.go b/examples/cdk8s-sample-deployment/imports/k8s/MetricSpecV2.go new file mode 100644 index 0000000..3572e11 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/MetricSpecV2.go @@ -0,0 +1,25 @@ +package k8s + + +// MetricSpec specifies how to scale based on a single metric (only `type` and one other matching field should be set at once). +type MetricSpecV2 struct { + // type is the type of metric source. + // + // It should be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled + Type *string `field:"required" json:"type" yaml:"type"` + // containerResource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag. + ContainerResource *ContainerResourceMetricSourceV2 `field:"optional" json:"containerResource" yaml:"containerResource"` + // external refers to a global metric that is not associated with any Kubernetes object. + // + // It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). + External *ExternalMetricSourceV2 `field:"optional" json:"external" yaml:"external"` + // object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object). + Object *ObjectMetricSourceV2 `field:"optional" json:"object" yaml:"object"` + // pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). + // + // The values will be averaged together before being compared to the target value. + Pods *PodsMetricSourceV2 `field:"optional" json:"pods" yaml:"pods"` + // resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. + Resource *ResourceMetricSourceV2 `field:"optional" json:"resource" yaml:"resource"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/MetricSpecV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/MetricSpecV2Beta2.go new file mode 100644 index 0000000..a83f1bc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/MetricSpecV2Beta2.go @@ -0,0 +1,25 @@ +package k8s + + +// MetricSpec specifies how to scale based on a single metric (only `type` and one other matching field should be set at once). +type MetricSpecV2Beta2 struct { + // type is the type of metric source. + // + // It should be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled + Type *string `field:"required" json:"type" yaml:"type"` + // container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag. + ContainerResource *ContainerResourceMetricSourceV2Beta2 `field:"optional" json:"containerResource" yaml:"containerResource"` + // external refers to a global metric that is not associated with any Kubernetes object. + // + // It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). + External *ExternalMetricSourceV2Beta2 `field:"optional" json:"external" yaml:"external"` + // object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object). + Object *ObjectMetricSourceV2Beta2 `field:"optional" json:"object" yaml:"object"` + // pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). + // + // The values will be averaged together before being compared to the target value. + Pods *PodsMetricSourceV2Beta2 `field:"optional" json:"pods" yaml:"pods"` + // resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. + Resource *ResourceMetricSourceV2Beta2 `field:"optional" json:"resource" yaml:"resource"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/MetricTargetV2.go b/examples/cdk8s-sample-deployment/imports/k8s/MetricTargetV2.go new file mode 100644 index 0000000..ba6fd92 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/MetricTargetV2.go @@ -0,0 +1,17 @@ +package k8s + + +// MetricTarget defines the target value, average value, or average utilization of a specific metric. +type MetricTargetV2 struct { + // type represents whether the metric type is Utilization, Value, or AverageValue. + Type *string `field:"required" json:"type" yaml:"type"` + // averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. + // + // Currently only valid for Resource metric source type. + AverageUtilization *float64 `field:"optional" json:"averageUtilization" yaml:"averageUtilization"` + // averageValue is the target value of the average of the metric across all relevant pods (as a quantity). + AverageValue Quantity `field:"optional" json:"averageValue" yaml:"averageValue"` + // value is the target value of the metric (as a quantity). + Value Quantity `field:"optional" json:"value" yaml:"value"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/MetricTargetV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/MetricTargetV2Beta2.go new file mode 100644 index 0000000..b8e66ae --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/MetricTargetV2Beta2.go @@ -0,0 +1,17 @@ +package k8s + + +// MetricTarget defines the target value, average value, or average utilization of a specific metric. +type MetricTargetV2Beta2 struct { + // type represents whether the metric type is Utilization, Value, or AverageValue. + Type *string `field:"required" json:"type" yaml:"type"` + // averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. + // + // Currently only valid for Resource metric source type. + AverageUtilization *float64 `field:"optional" json:"averageUtilization" yaml:"averageUtilization"` + // averageValue is the target value of the average of the metric across all relevant pods (as a quantity). + AverageValue Quantity `field:"optional" json:"averageValue" yaml:"averageValue"` + // value is the target value of the metric (as a quantity). + Value Quantity `field:"optional" json:"value" yaml:"value"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/MutatingWebhook.go b/examples/cdk8s-sample-deployment/imports/k8s/MutatingWebhook.go new file mode 100644 index 0000000..5cc0c61 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/MutatingWebhook.go @@ -0,0 +1,103 @@ +package k8s + + +// MutatingWebhook describes an admission webhook and the resources and operations it applies to. +type MutatingWebhook struct { + // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. + // + // API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy. + AdmissionReviewVersions *[]*string `field:"required" json:"admissionReviewVersions" yaml:"admissionReviewVersions"` + // ClientConfig defines how to communicate with the hook. + // + // Required. + ClientConfig *WebhookClientConfig `field:"required" json:"clientConfig" yaml:"clientConfig"` + // The name of the admission webhook. + // + // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where "imagepolicy" is the name of the webhook, and kubernetes.io is the name of the organization. Required. + Name *string `field:"required" json:"name" yaml:"name"` + // SideEffects states whether this webhook has side effects. + // + // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. + SideEffects *string `field:"required" json:"sideEffects" yaml:"sideEffects"` + // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. + // + // Defaults to Fail. + // Default: Fail. + // + FailurePolicy *string `field:"optional" json:"failurePolicy" yaml:"failurePolicy"` + // matchPolicy defines how the "rules" list is used to match incoming requests. Allowed values are "Exact" or "Equivalent". + // + // - Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook. + // + // - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook. + // + // Defaults to "Equivalent". + // Default: Equivalent". + // + MatchPolicy *string `field:"optional" json:"matchPolicy" yaml:"matchPolicy"` + // NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. + // + // If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook. + // + // For example, to run the webhook on any objects whose namespace is not associated with "runlevel" of "0" or "1"; you will set the selector as follows: "namespaceSelector": { + // "matchExpressions": [ + // { + // "key": "runlevel", + // "operator": "NotIn", + // "values": [ + // "0", + // "1" + // ] + // } + // ] + // } + // + // If instead you want to only run the webhook on any objects whose namespace is associated with the "environment" of "prod" or "staging"; you will set the selector as follows: "namespaceSelector": { + // "matchExpressions": [ + // { + // "key": "environment", + // "operator": "In", + // "values": [ + // "prod", + // "staging" + // ] + // } + // ] + // } + // + // See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors. + // + // Default to the empty LabelSelector, which matches everything. + // Default: the empty LabelSelector, which matches everything. + // + NamespaceSelector *LabelSelector `field:"optional" json:"namespaceSelector" yaml:"namespaceSelector"` + // ObjectSelector decides whether to run the webhook based on if the object has matching labels. + // + // objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything. + // Default: the empty LabelSelector, which matches everything. + // + ObjectSelector *LabelSelector `field:"optional" json:"objectSelector" yaml:"objectSelector"` + // reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation. + // + // Allowed values are "Never" and "IfNeeded". + // + // Never: the webhook will not be called more than once in a single admission evaluation. + // + // IfNeeded: the webhook will be called at least one additional time as part of the admission evaluation if the object being admitted is modified by other admission plugins after the initial webhook call. Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted. Note: * the number of additional invocations is not guaranteed to be exactly one. * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again. * webhooks that use this option may be reordered to minimize the number of additional invocations. * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead. + // + // Defaults to "Never". + // Default: Never". + // + ReinvocationPolicy *string `field:"optional" json:"reinvocationPolicy" yaml:"reinvocationPolicy"` + // Rules describes what operations on what resources/subresources the webhook cares about. + // + // The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. + Rules *[]*RuleWithOperations `field:"optional" json:"rules" yaml:"rules"` + // TimeoutSeconds specifies the timeout for this webhook. + // + // After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds. + // Default: 10 seconds. + // + TimeoutSeconds *float64 `field:"optional" json:"timeoutSeconds" yaml:"timeoutSeconds"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NamespaceSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/NamespaceSpec.go new file mode 100644 index 0000000..f064f84 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NamespaceSpec.go @@ -0,0 +1,11 @@ +package k8s + + +// NamespaceSpec describes the attributes on a Namespace. +type NamespaceSpec struct { + // Finalizers is an opaque list of values that must be empty to permanently remove object from storage. + // + // More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/ + Finalizers *[]*string `field:"optional" json:"finalizers" yaml:"finalizers"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyEgressRule.go b/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyEgressRule.go new file mode 100644 index 0000000..17e73d1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyEgressRule.go @@ -0,0 +1,17 @@ +package k8s + + +// NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods matched by a NetworkPolicySpec's podSelector. +// +// The traffic must match both ports and to. This type is beta-level in 1.8 +type NetworkPolicyEgressRule struct { + // List of destination ports for outgoing traffic. + // + // Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list. + Ports *[]*NetworkPolicyPort `field:"optional" json:"ports" yaml:"ports"` + // List of destinations for outgoing traffic of pods selected for this rule. + // + // Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all destinations (traffic not restricted by destination). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the to list. + To *[]*NetworkPolicyPeer `field:"optional" json:"to" yaml:"to"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyIngressRule.go b/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyIngressRule.go new file mode 100644 index 0000000..4c53738 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyIngressRule.go @@ -0,0 +1,17 @@ +package k8s + + +// NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods matched by a NetworkPolicySpec's podSelector. +// +// The traffic must match both ports and from. +type NetworkPolicyIngressRule struct { + // List of sources which should be able to access the pods selected for this rule. + // + // Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list. + From *[]*NetworkPolicyPeer `field:"optional" json:"from" yaml:"from"` + // List of ports which should be made accessible on the pods selected for this rule. + // + // Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list. + Ports *[]*NetworkPolicyPort `field:"optional" json:"ports" yaml:"ports"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyPeer.go b/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyPeer.go new file mode 100644 index 0000000..05e0097 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyPeer.go @@ -0,0 +1,25 @@ +package k8s + + +// NetworkPolicyPeer describes a peer to allow traffic to/from. +// +// Only certain combinations of fields are allowed. +type NetworkPolicyPeer struct { + // IPBlock defines policy on a particular IPBlock. + // + // If this field is set then neither of the other fields can be. + IpBlock *IpBlock `field:"optional" json:"ipBlock" yaml:"ipBlock"` + // Selects Namespaces using cluster-scoped labels. + // + // This field follows standard label selector semantics; if present but empty, it selects all namespaces. + // + // If PodSelector is also set, then the NetworkPolicyPeer as a whole selects the Pods matching PodSelector in the Namespaces selected by NamespaceSelector. Otherwise it selects all Pods in the Namespaces selected by NamespaceSelector. + NamespaceSelector *LabelSelector `field:"optional" json:"namespaceSelector" yaml:"namespaceSelector"` + // This is a label selector which selects Pods. + // + // This field follows standard label selector semantics; if present but empty, it selects all pods. + // + // If NamespaceSelector is also set, then the NetworkPolicyPeer as a whole selects the Pods matching PodSelector in the Namespaces selected by NamespaceSelector. Otherwise it selects the Pods matching PodSelector in the policy's own Namespace. + PodSelector *LabelSelector `field:"optional" json:"podSelector" yaml:"podSelector"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyPort.go b/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyPort.go new file mode 100644 index 0000000..bc46343 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicyPort.go @@ -0,0 +1,19 @@ +package k8s + + +// NetworkPolicyPort describes a port to allow traffic on. +type NetworkPolicyPort struct { + // If set, indicates that the range of ports from port to endPort, inclusive, should be allowed by the policy. + // + // This field cannot be defined if the port field is not defined or if the port field is defined as a named (string) port. The endPort must be equal or greater than port. + EndPort *float64 `field:"optional" json:"endPort" yaml:"endPort"` + // The port on the given protocol. + // + // This can either be a numerical or named port on a pod. If this field is not provided, this matches all port names and numbers. If present, only traffic on the specified protocol AND port will be matched. + Port IntOrString `field:"optional" json:"port" yaml:"port"` + // The protocol (TCP, UDP, or SCTP) which traffic must match. + // + // If not specified, this field defaults to TCP. + Protocol *string `field:"optional" json:"protocol" yaml:"protocol"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicySpec.go b/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicySpec.go new file mode 100644 index 0000000..ef3d2e7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NetworkPolicySpec.go @@ -0,0 +1,23 @@ +package k8s + + +// NetworkPolicySpec provides the specification of a NetworkPolicy. +type NetworkPolicySpec struct { + // Selects the pods to which this NetworkPolicy object applies. + // + // The array of ingress rules is applied to any pods selected by this field. Multiple network policies can select the same set of pods. In this case, the ingress rules for each are combined additively. This field is NOT optional and follows standard label selector semantics. An empty podSelector matches all pods in this namespace. + PodSelector *LabelSelector `field:"required" json:"podSelector" yaml:"podSelector"` + // List of egress rules to be applied to the selected pods. + // + // Outgoing traffic is allowed if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic matches at least one egress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy limits all outgoing traffic (and serves solely to ensure that the pods it selects are isolated by default). This field is beta-level in 1.8 + Egress *[]*NetworkPolicyEgressRule `field:"optional" json:"egress" yaml:"egress"` + // List of ingress rules to be applied to the selected pods. + // + // Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic source is the pod's local node, OR if the traffic matches at least one ingress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy does not allow any traffic (and serves solely to ensure that the pods it selects are isolated by default) + Ingress *[]*NetworkPolicyIngressRule `field:"optional" json:"ingress" yaml:"ingress"` + // List of rule types that the NetworkPolicy relates to. + // + // Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"]. If this field is not specified, it will default based on the existence of Ingress or Egress rules; policies that contain an Egress section are assumed to affect Egress, and all policies (whether or not they contain an Ingress section) are assumed to affect Ingress. If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ]. Likewise, if you want to write a policy that specifies that no egress is allowed, you must specify a policyTypes value that include "Egress" (since such a policy would not include an Egress section and would otherwise default to just [ "Ingress" ]). This field is beta-level in 1.8 + PolicyTypes *[]*string `field:"optional" json:"policyTypes" yaml:"policyTypes"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NfsVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/NfsVolumeSource.go new file mode 100644 index 0000000..5f33eb9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NfsVolumeSource.go @@ -0,0 +1,23 @@ +package k8s + + +// Represents an NFS mount that lasts the lifetime of a pod. +// +// NFS volumes do not support ownership management or SELinux relabeling. +type NfsVolumeSource struct { + // path that is exported by the NFS server. + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + Path *string `field:"required" json:"path" yaml:"path"` + // server is the hostname or IP address of the NFS server. + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + Server *string `field:"required" json:"server" yaml:"server"` + // readOnly here will force the NFS export to be mounted with read-only permissions. + // + // Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + // Default: false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NodeAffinity.go b/examples/cdk8s-sample-deployment/imports/k8s/NodeAffinity.go new file mode 100644 index 0000000..8bec2f3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NodeAffinity.go @@ -0,0 +1,15 @@ +package k8s + + +// Node affinity is a group of node affinity scheduling rules. +type NodeAffinity struct { + // The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. + // + // The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred. + PreferredDuringSchedulingIgnoredDuringExecution *[]*PreferredSchedulingTerm `field:"optional" json:"preferredDuringSchedulingIgnoredDuringExecution" yaml:"preferredDuringSchedulingIgnoredDuringExecution"` + // If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. + // + // If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node. + RequiredDuringSchedulingIgnoredDuringExecution *NodeSelector `field:"optional" json:"requiredDuringSchedulingIgnoredDuringExecution" yaml:"requiredDuringSchedulingIgnoredDuringExecution"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NodeConfigSource.go b/examples/cdk8s-sample-deployment/imports/k8s/NodeConfigSource.go new file mode 100644 index 0000000..ef8e92e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NodeConfigSource.go @@ -0,0 +1,11 @@ +package k8s + + +// NodeConfigSource specifies a source of node configuration. +// +// Exactly one subfield (excluding metadata) must be non-nil. This API is deprecated since 1.22 +type NodeConfigSource struct { + // ConfigMap is a reference to a Node's ConfigMap. + ConfigMap *ConfigMapNodeConfigSource `field:"optional" json:"configMap" yaml:"configMap"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NodeSelector.go b/examples/cdk8s-sample-deployment/imports/k8s/NodeSelector.go new file mode 100644 index 0000000..4dfb030 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NodeSelector.go @@ -0,0 +1,13 @@ +package k8s + + +// A node selector represents the union of the results of one or more label queries over a set of nodes; +// +// that is, it represents the OR of the selectors represented by the node selector terms. +type NodeSelector struct { + // Required. + // + // A list of node selector terms. The terms are ORed. + NodeSelectorTerms *[]*NodeSelectorTerm `field:"required" json:"nodeSelectorTerms" yaml:"nodeSelectorTerms"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NodeSelectorRequirement.go b/examples/cdk8s-sample-deployment/imports/k8s/NodeSelectorRequirement.go new file mode 100644 index 0000000..e4eafad --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NodeSelectorRequirement.go @@ -0,0 +1,17 @@ +package k8s + + +// A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. +type NodeSelectorRequirement struct { + // The label key that the selector applies to. + Key *string `field:"required" json:"key" yaml:"key"` + // Represents a key's relationship to a set of values. + // + // Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + Operator *string `field:"required" json:"operator" yaml:"operator"` + // An array of string values. + // + // If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. + Values *[]*string `field:"optional" json:"values" yaml:"values"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NodeSelectorTerm.go b/examples/cdk8s-sample-deployment/imports/k8s/NodeSelectorTerm.go new file mode 100644 index 0000000..77e7146 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NodeSelectorTerm.go @@ -0,0 +1,13 @@ +package k8s + + +// A null or empty node selector term matches no objects. +// +// The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. +type NodeSelectorTerm struct { + // A list of node selector requirements by node's labels. + MatchExpressions *[]*NodeSelectorRequirement `field:"optional" json:"matchExpressions" yaml:"matchExpressions"` + // A list of node selector requirements by node's fields. + MatchFields *[]*NodeSelectorRequirement `field:"optional" json:"matchFields" yaml:"matchFields"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NodeSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/NodeSpec.go new file mode 100644 index 0000000..1b4f6a6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NodeSpec.go @@ -0,0 +1,29 @@ +package k8s + + +// NodeSpec describes the attributes that a node is created with. +type NodeSpec struct { + // Deprecated: Previously used to specify the source of the node's configuration for the DynamicKubeletConfig feature. + // + // This feature is removed from Kubelets as of 1.24 and will be fully removed in 1.26. + ConfigSource *NodeConfigSource `field:"optional" json:"configSource" yaml:"configSource"` + // Deprecated. + // + // Not all kubelets will set this field. Remove field after 1.13. see: https://issues.k8s.io/61966 + ExternalId *string `field:"optional" json:"externalId" yaml:"externalId"` + // PodCIDR represents the pod IP range assigned to the node. + PodCidr *string `field:"optional" json:"podCidr" yaml:"podCidr"` + // podCIDRs represents the IP ranges assigned to the node for usage by Pods on that node. + // + // If this field is specified, the 0th entry must match the podCIDR field. It may contain at most 1 value for each of IPv4 and IPv6. + PodCidRs *[]*string `field:"optional" json:"podCidRs" yaml:"podCidRs"` + // ID of the node assigned by the cloud provider in the format: ://. + ProviderId *string `field:"optional" json:"providerId" yaml:"providerId"` + // If specified, the node's taints. + Taints *[]*Taint `field:"optional" json:"taints" yaml:"taints"` + // Unschedulable controls node schedulability of new pods. + // + // By default, node is schedulable. More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administration + Unschedulable *bool `field:"optional" json:"unschedulable" yaml:"unschedulable"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NonResourceAttributes.go b/examples/cdk8s-sample-deployment/imports/k8s/NonResourceAttributes.go new file mode 100644 index 0000000..ed290a9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NonResourceAttributes.go @@ -0,0 +1,11 @@ +package k8s + + +// NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface. +type NonResourceAttributes struct { + // Path is the URL path of the request. + Path *string `field:"optional" json:"path" yaml:"path"` + // Verb is the standard HTTP verb. + Verb *string `field:"optional" json:"verb" yaml:"verb"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NonResourcePolicyRuleV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/NonResourcePolicyRuleV1Beta1.go new file mode 100644 index 0000000..bf69003 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NonResourcePolicyRuleV1Beta1.go @@ -0,0 +1,23 @@ +package k8s + + +// NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the target non-resource URL. +// +// A NonResourcePolicyRule matches a request if and only if both (a) at least one member of verbs matches the request and (b) at least one member of nonResourceURLs matches the request. +type NonResourcePolicyRuleV1Beta1 struct { + // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. + // + // For example: + // - "/healthz" is legal + // - "/hea*" is illegal + // - "/hea" is legal but matches nothing + // - "/hea/*" also matches nothing + // - "/healthz/*" matches all per-component health checks. + // "*" matches all non-resource urls. if it is present, it must be the only entry. Required. + NonResourceUrLs *[]*string `field:"required" json:"nonResourceUrLs" yaml:"nonResourceUrLs"` + // `verbs` is a list of matching verbs and may not be empty. + // + // "*" matches all verbs. If it is present, it must be the only entry. Required. + Verbs *[]*string `field:"required" json:"verbs" yaml:"verbs"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/NonResourcePolicyRuleV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/NonResourcePolicyRuleV1Beta2.go new file mode 100644 index 0000000..aa2bdf1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/NonResourcePolicyRuleV1Beta2.go @@ -0,0 +1,23 @@ +package k8s + + +// NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the target non-resource URL. +// +// A NonResourcePolicyRule matches a request if and only if both (a) at least one member of verbs matches the request and (b) at least one member of nonResourceURLs matches the request. +type NonResourcePolicyRuleV1Beta2 struct { + // `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. + // + // For example: + // - "/healthz" is legal + // - "/hea*" is illegal + // - "/hea" is legal but matches nothing + // - "/hea/*" also matches nothing + // - "/healthz/*" matches all per-component health checks. + // "*" matches all non-resource urls. if it is present, it must be the only entry. Required. + NonResourceUrLs *[]*string `field:"required" json:"nonResourceUrLs" yaml:"nonResourceUrLs"` + // `verbs` is a list of matching verbs and may not be empty. + // + // "*" matches all verbs. If it is present, it must be the only entry. Required. + Verbs *[]*string `field:"required" json:"verbs" yaml:"verbs"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ObjectFieldSelector.go b/examples/cdk8s-sample-deployment/imports/k8s/ObjectFieldSelector.go new file mode 100644 index 0000000..d762c54 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ObjectFieldSelector.go @@ -0,0 +1,11 @@ +package k8s + + +// ObjectFieldSelector selects an APIVersioned field of an object. +type ObjectFieldSelector struct { + // Path of the field to select in the specified API version. + FieldPath *string `field:"required" json:"fieldPath" yaml:"fieldPath"` + // Version of the schema the FieldPath is written in terms of, defaults to "v1". + ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ObjectMeta.go b/examples/cdk8s-sample-deployment/imports/k8s/ObjectMeta.go new file mode 100644 index 0000000..629bfbc --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ObjectMeta.go @@ -0,0 +1,82 @@ +package k8s + +import ( + "time" +) + +// ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create. +type ObjectMeta struct { + // Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. + // + // They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations + Annotations *map[string]*string `field:"optional" json:"annotations" yaml:"annotations"` + // CreationTimestamp is a timestamp representing the server time when this object was created. + // + // It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. + // + // Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + CreationTimestamp *time.Time `field:"optional" json:"creationTimestamp" yaml:"creationTimestamp"` + // Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. + // + // Only set when deletionTimestamp is also set. May only be shortened. Read-only. + DeletionGracePeriodSeconds *float64 `field:"optional" json:"deletionGracePeriodSeconds" yaml:"deletionGracePeriodSeconds"` + // DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. + // + // This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested. + // + // Populated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + DeletionTimestamp *time.Time `field:"optional" json:"deletionTimestamp" yaml:"deletionTimestamp"` + // Must be empty before the object is deleted from the registry. + // + // Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list. + Finalizers *[]*string `field:"optional" json:"finalizers" yaml:"finalizers"` + // GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. + // + // If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. + // + // If this field is specified and the generated name exists, the server will return a 409. + // + // Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency + GenerateName *string `field:"optional" json:"generateName" yaml:"generateName"` + // A sequence number representing a specific generation of the desired state. + // + // Populated by the system. Read-only. + Generation *float64 `field:"optional" json:"generation" yaml:"generation"` + // Map of string keys and values that can be used to organize and categorize (scope and select) objects. + // + // May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels + Labels *map[string]*string `field:"optional" json:"labels" yaml:"labels"` + // ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. + // + // This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object. + ManagedFields *[]*ManagedFieldsEntry `field:"optional" json:"managedFields" yaml:"managedFields"` + // Name must be unique within a namespace. + // + // Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names + Name *string `field:"optional" json:"name" yaml:"name"` + // Namespace defines the space within which each name must be unique. + // + // An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. + // + // Must be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces + Namespace *string `field:"optional" json:"namespace" yaml:"namespace"` + // List of objects depended by this object. + // + // If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. + OwnerReferences *[]*OwnerReference `field:"optional" json:"ownerReferences" yaml:"ownerReferences"` + // An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. + // + // May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. + // + // Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + ResourceVersion *string `field:"optional" json:"resourceVersion" yaml:"resourceVersion"` + // Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + SelfLink *string `field:"optional" json:"selfLink" yaml:"selfLink"` + // UID is the unique in time and space value for this object. + // + // It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. + // + // Populated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids + Uid *string `field:"optional" json:"uid" yaml:"uid"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ObjectMetricSourceV2.go b/examples/cdk8s-sample-deployment/imports/k8s/ObjectMetricSourceV2.go new file mode 100644 index 0000000..a5eee2b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ObjectMetricSourceV2.go @@ -0,0 +1,13 @@ +package k8s + + +// ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object). +type ObjectMetricSourceV2 struct { + // describedObject specifies the descriptions of a object,such as kind,name apiVersion. + DescribedObject *CrossVersionObjectReferenceV2 `field:"required" json:"describedObject" yaml:"describedObject"` + // metric identifies the target metric by name and selector. + Metric *MetricIdentifierV2 `field:"required" json:"metric" yaml:"metric"` + // target specifies the target value for the given metric. + Target *MetricTargetV2 `field:"required" json:"target" yaml:"target"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ObjectMetricSourceV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/ObjectMetricSourceV2Beta2.go new file mode 100644 index 0000000..cff4689 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ObjectMetricSourceV2Beta2.go @@ -0,0 +1,12 @@ +package k8s + + +// ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object). +type ObjectMetricSourceV2Beta2 struct { + DescribedObject *CrossVersionObjectReferenceV2Beta2 `field:"required" json:"describedObject" yaml:"describedObject"` + // metric identifies the target metric by name and selector. + Metric *MetricIdentifierV2Beta2 `field:"required" json:"metric" yaml:"metric"` + // target specifies the target value for the given metric. + Target *MetricTargetV2Beta2 `field:"required" json:"target" yaml:"target"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ObjectReference.go b/examples/cdk8s-sample-deployment/imports/k8s/ObjectReference.go new file mode 100644 index 0000000..c7c1a51 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ObjectReference.go @@ -0,0 +1,31 @@ +package k8s + + +// ObjectReference contains enough information to let you inspect or modify the referred object. +type ObjectReference struct { + // API version of the referent. + ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"` + // If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. + FieldPath *string `field:"optional" json:"fieldPath" yaml:"fieldPath"` + // Kind of the referent. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Kind *string `field:"optional" json:"kind" yaml:"kind"` + // Name of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `field:"optional" json:"name" yaml:"name"` + // Namespace of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + Namespace *string `field:"optional" json:"namespace" yaml:"namespace"` + // Specific resourceVersion to which this reference is made, if any. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + ResourceVersion *string `field:"optional" json:"resourceVersion" yaml:"resourceVersion"` + // UID of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + Uid *string `field:"optional" json:"uid" yaml:"uid"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Overhead.go b/examples/cdk8s-sample-deployment/imports/k8s/Overhead.go new file mode 100644 index 0000000..1253662 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Overhead.go @@ -0,0 +1,9 @@ +package k8s + + +// Overhead structure represents the resource overhead associated with running a pod. +type Overhead struct { + // PodFixed represents the fixed resource overhead associated with running a pod. + PodFixed *map[string]Quantity `field:"optional" json:"podFixed" yaml:"podFixed"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/OwnerReference.go b/examples/cdk8s-sample-deployment/imports/k8s/OwnerReference.go new file mode 100644 index 0000000..b033f77 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/OwnerReference.go @@ -0,0 +1,31 @@ +package k8s + + +// OwnerReference contains enough information to let you identify an owning object. +// +// An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field. +type OwnerReference struct { + // API version of the referent. + ApiVersion *string `field:"required" json:"apiVersion" yaml:"apiVersion"` + // Kind of the referent. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Kind *string `field:"required" json:"kind" yaml:"kind"` + // Name of the referent. + // + // More info: http://kubernetes.io/docs/user-guide/identifiers#names + Name *string `field:"required" json:"name" yaml:"name"` + // UID of the referent. + // + // More info: http://kubernetes.io/docs/user-guide/identifiers#uids + Uid *string `field:"required" json:"uid" yaml:"uid"` + // If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. + // + // See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. + // Default: false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. + // + BlockOwnerDeletion *bool `field:"optional" json:"blockOwnerDeletion" yaml:"blockOwnerDeletion"` + // If true, this reference points to the managing controller. + Controller *bool `field:"optional" json:"controller" yaml:"controller"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeClaimSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeClaimSpec.go new file mode 100644 index 0000000..b2ec851 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeClaimSpec.go @@ -0,0 +1,38 @@ +package k8s + + +// PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes. +type PersistentVolumeClaimSpec struct { + // accessModes contains the desired access modes the volume should have. + // + // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + AccessModes *[]*string `field:"optional" json:"accessModes" yaml:"accessModes"` + // dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. If the AnyVolumeDataSource feature gate is enabled, this field will always have the same contents as the DataSourceRef field. + DataSource *TypedLocalObjectReference `field:"optional" json:"dataSource" yaml:"dataSource"` + // dataSourceRef specifies the object from which to populate the volume with data, if a non-empty volume is desired. + // + // This may be any local object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the DataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, both fields (DataSource and DataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty. There are two important differences between DataSource and DataSourceRef: * While DataSource only allows two specific types of objects, DataSourceRef + // allows any non-core object, as well as PersistentVolumeClaim objects. + // * While DataSource ignores disallowed values (dropping them), DataSourceRef + // preserves all values, and generates an error if a disallowed value is + // specified. + // (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + DataSourceRef *TypedLocalObjectReference `field:"optional" json:"dataSourceRef" yaml:"dataSourceRef"` + // resources represents the minimum resources the volume should have. + // + // If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements that are lower than previous value but must still be higher than capacity recorded in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources + Resources *ResourceRequirements `field:"optional" json:"resources" yaml:"resources"` + // selector is a label query over volumes to consider for binding. + Selector *LabelSelector `field:"optional" json:"selector" yaml:"selector"` + // storageClassName is the name of the StorageClass required by the claim. + // + // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 + StorageClassName *string `field:"optional" json:"storageClassName" yaml:"storageClassName"` + // volumeMode defines what type of volume is required by the claim. + // + // Value of Filesystem is implied when not included in claim spec. + VolumeMode *string `field:"optional" json:"volumeMode" yaml:"volumeMode"` + // volumeName is the binding reference to the PersistentVolume backing this claim. + VolumeName *string `field:"optional" json:"volumeName" yaml:"volumeName"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeClaimTemplate.go b/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeClaimTemplate.go new file mode 100644 index 0000000..8ed01f2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeClaimTemplate.go @@ -0,0 +1,15 @@ +package k8s + + +// PersistentVolumeClaimTemplate is used to produce PersistentVolumeClaim objects as part of an EphemeralVolumeSource. +type PersistentVolumeClaimTemplate struct { + // The specification for the PersistentVolumeClaim. + // + // The entire content is copied unchanged into the PVC that gets created from this template. The same fields as in a PersistentVolumeClaim are also valid here. + Spec *PersistentVolumeClaimSpec `field:"required" json:"spec" yaml:"spec"` + // May contain labels and annotations that will be copied into the PVC when creating it. + // + // No other fields are allowed and will be rejected during validation. + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeClaimVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeClaimVolumeSource.go new file mode 100644 index 0000000..d2dddaf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeClaimVolumeSource.go @@ -0,0 +1,17 @@ +package k8s + + +// PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. +// +// This volume finds the bound PV and mounts that volume for the pod. A PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another type of volume that is owned by someone else (the system). +type PersistentVolumeClaimVolumeSource struct { + // claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + // + // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + ClaimName *string `field:"required" json:"claimName" yaml:"claimName"` + // readOnly Will force the ReadOnly setting in VolumeMounts. + // + // Default false. + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeSpec.go new file mode 100644 index 0000000..9cafe83 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PersistentVolumeSpec.go @@ -0,0 +1,99 @@ +package k8s + + +// PersistentVolumeSpec is the specification of a persistent volume. +type PersistentVolumeSpec struct { + // accessModes contains all ways the volume can be mounted. + // + // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes + AccessModes *[]*string `field:"optional" json:"accessModes" yaml:"accessModes"` + // awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + AwsElasticBlockStore *AwsElasticBlockStoreVolumeSource `field:"optional" json:"awsElasticBlockStore" yaml:"awsElasticBlockStore"` + // azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. + AzureDisk *AzureDiskVolumeSource `field:"optional" json:"azureDisk" yaml:"azureDisk"` + // azureFile represents an Azure File Service mount on the host and bind mount to the pod. + AzureFile *AzureFilePersistentVolumeSource `field:"optional" json:"azureFile" yaml:"azureFile"` + // capacity is the description of the persistent volume's resources and capacity. + // + // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity + Capacity *map[string]Quantity `field:"optional" json:"capacity" yaml:"capacity"` + // cephFS represents a Ceph FS mount on the host that shares a pod's lifetime. + Cephfs *CephFsPersistentVolumeSource `field:"optional" json:"cephfs" yaml:"cephfs"` + // cinder represents a cinder volume attached and mounted on kubelets host machine. + // + // More info: https://examples.k8s.io/mysql-cinder-pd/README.md + Cinder *CinderPersistentVolumeSource `field:"optional" json:"cinder" yaml:"cinder"` + // claimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. + // + // Expected to be non-nil when bound. claim.VolumeName is the authoritative bind between PV and PVC. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding + ClaimRef *ObjectReference `field:"optional" json:"claimRef" yaml:"claimRef"` + // csi represents storage that is handled by an external CSI driver (Beta feature). + Csi *CsiPersistentVolumeSource `field:"optional" json:"csi" yaml:"csi"` + // fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. + Fc *FcVolumeSource `field:"optional" json:"fc" yaml:"fc"` + // flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. + FlexVolume *FlexPersistentVolumeSource `field:"optional" json:"flexVolume" yaml:"flexVolume"` + // flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. + // + // This depends on the Flocker control service being running. + Flocker *FlockerVolumeSource `field:"optional" json:"flocker" yaml:"flocker"` + // gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. + // + // Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + GcePersistentDisk *GcePersistentDiskVolumeSource `field:"optional" json:"gcePersistentDisk" yaml:"gcePersistentDisk"` + // glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod. + // + // Provisioned by an admin. More info: https://examples.k8s.io/volumes/glusterfs/README.md + Glusterfs *GlusterfsPersistentVolumeSource `field:"optional" json:"glusterfs" yaml:"glusterfs"` + // hostPath represents a directory on the host. + // + // Provisioned by a developer or tester. This is useful for single-node development and testing only! On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + HostPath *HostPathVolumeSource `field:"optional" json:"hostPath" yaml:"hostPath"` + // iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. + // + // Provisioned by an admin. + Iscsi *IscsiPersistentVolumeSource `field:"optional" json:"iscsi" yaml:"iscsi"` + // local represents directly-attached storage with node affinity. + Local *LocalVolumeSource `field:"optional" json:"local" yaml:"local"` + // mountOptions is the list of mount options, e.g. ["ro", "soft"]. Not validated - mount will simply fail if one is invalid. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options. + MountOptions *[]*string `field:"optional" json:"mountOptions" yaml:"mountOptions"` + // nfs represents an NFS mount on the host. + // + // Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + Nfs *NfsVolumeSource `field:"optional" json:"nfs" yaml:"nfs"` + // nodeAffinity defines constraints that limit what nodes this volume can be accessed from. + // + // This field influences the scheduling of pods that use this volume. + NodeAffinity *VolumeNodeAffinity `field:"optional" json:"nodeAffinity" yaml:"nodeAffinity"` + // persistentVolumeReclaimPolicy defines what happens to a persistent volume when released from its claim. + // + // Valid options are Retain (default for manually created PersistentVolumes), Delete (default for dynamically provisioned PersistentVolumes), and Recycle (deprecated). Recycle must be supported by the volume plugin underlying this PersistentVolume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming + PersistentVolumeReclaimPolicy *string `field:"optional" json:"persistentVolumeReclaimPolicy" yaml:"persistentVolumeReclaimPolicy"` + // photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. + PhotonPersistentDisk *PhotonPersistentDiskVolumeSource `field:"optional" json:"photonPersistentDisk" yaml:"photonPersistentDisk"` + // portworxVolume represents a portworx volume attached and mounted on kubelets host machine. + PortworxVolume *PortworxVolumeSource `field:"optional" json:"portworxVolume" yaml:"portworxVolume"` + // quobyte represents a Quobyte mount on the host that shares a pod's lifetime. + Quobyte *QuobyteVolumeSource `field:"optional" json:"quobyte" yaml:"quobyte"` + // rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + // + // More info: https://examples.k8s.io/volumes/rbd/README.md + Rbd *RbdPersistentVolumeSource `field:"optional" json:"rbd" yaml:"rbd"` + // scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. + ScaleIo *ScaleIoPersistentVolumeSource `field:"optional" json:"scaleIo" yaml:"scaleIo"` + // storageClassName is the name of StorageClass to which this persistent volume belongs. + // + // Empty value means that this volume does not belong to any StorageClass. + StorageClassName *string `field:"optional" json:"storageClassName" yaml:"storageClassName"` + // storageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod More info: https://examples.k8s.io/volumes/storageos/README.md. + Storageos *StorageOsPersistentVolumeSource `field:"optional" json:"storageos" yaml:"storageos"` + // volumeMode defines if a volume is intended to be used with a formatted filesystem or to remain in raw block state. + // + // Value of Filesystem is implied when not included in spec. + VolumeMode *string `field:"optional" json:"volumeMode" yaml:"volumeMode"` + // vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine. + VsphereVolume *VsphereVirtualDiskVolumeSource `field:"optional" json:"vsphereVolume" yaml:"vsphereVolume"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PhotonPersistentDiskVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/PhotonPersistentDiskVolumeSource.go new file mode 100644 index 0000000..dae63b3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PhotonPersistentDiskVolumeSource.go @@ -0,0 +1,13 @@ +package k8s + + +// Represents a Photon Controller persistent disk resource. +type PhotonPersistentDiskVolumeSource struct { + // pdID is the ID that identifies Photon Controller persistent disk. + PdId *string `field:"required" json:"pdId" yaml:"pdId"` + // fsType is the filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodAffinity.go b/examples/cdk8s-sample-deployment/imports/k8s/PodAffinity.go new file mode 100644 index 0000000..dc11af2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodAffinity.go @@ -0,0 +1,15 @@ +package k8s + + +// Pod affinity is a group of inter pod affinity scheduling rules. +type PodAffinity struct { + // The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. + // + // The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. + PreferredDuringSchedulingIgnoredDuringExecution *[]*WeightedPodAffinityTerm `field:"optional" json:"preferredDuringSchedulingIgnoredDuringExecution" yaml:"preferredDuringSchedulingIgnoredDuringExecution"` + // If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. + // + // If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. + RequiredDuringSchedulingIgnoredDuringExecution *[]*PodAffinityTerm `field:"optional" json:"requiredDuringSchedulingIgnoredDuringExecution" yaml:"requiredDuringSchedulingIgnoredDuringExecution"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodAffinityTerm.go b/examples/cdk8s-sample-deployment/imports/k8s/PodAffinityTerm.go new file mode 100644 index 0000000..238a077 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodAffinityTerm.go @@ -0,0 +1,21 @@ +package k8s + + +// Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running. +type PodAffinityTerm struct { + // This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. + // + // Empty topologyKey is not allowed. + TopologyKey *string `field:"required" json:"topologyKey" yaml:"topologyKey"` + // A label query over a set of resources, in this case pods. + LabelSelector *LabelSelector `field:"optional" json:"labelSelector" yaml:"labelSelector"` + // namespaces specifies a static list of namespace names that the term applies to. + // + // The term is applied to the union of the namespaces listed in this field and the ones selected by namespaceSelector. null or empty namespaces list and null namespaceSelector means "this pod's namespace". + Namespaces *[]*string `field:"optional" json:"namespaces" yaml:"namespaces"` + // A label query over the set of namespaces that the term applies to. + // + // The term is applied to the union of the namespaces selected by this field and the ones listed in the namespaces field. null selector and null or empty namespaces list means "this pod's namespace". An empty selector ({}) matches all namespaces. + NamespaceSelector *LabelSelector `field:"optional" json:"namespaceSelector" yaml:"namespaceSelector"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodAntiAffinity.go b/examples/cdk8s-sample-deployment/imports/k8s/PodAntiAffinity.go new file mode 100644 index 0000000..61c83b5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodAntiAffinity.go @@ -0,0 +1,15 @@ +package k8s + + +// Pod anti affinity is a group of inter pod anti affinity scheduling rules. +type PodAntiAffinity struct { + // The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. + // + // The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. + PreferredDuringSchedulingIgnoredDuringExecution *[]*WeightedPodAffinityTerm `field:"optional" json:"preferredDuringSchedulingIgnoredDuringExecution" yaml:"preferredDuringSchedulingIgnoredDuringExecution"` + // If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. + // + // If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. + RequiredDuringSchedulingIgnoredDuringExecution *[]*PodAffinityTerm `field:"optional" json:"requiredDuringSchedulingIgnoredDuringExecution" yaml:"requiredDuringSchedulingIgnoredDuringExecution"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodDisruptionBudgetSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/PodDisruptionBudgetSpec.go new file mode 100644 index 0000000..0f0ccb4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodDisruptionBudgetSpec.go @@ -0,0 +1,15 @@ +package k8s + + +// PodDisruptionBudgetSpec is a description of a PodDisruptionBudget. +type PodDisruptionBudgetSpec struct { + // An eviction is allowed if at most "maxUnavailable" pods selected by "selector" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with "minAvailable". + MaxUnavailable IntOrString `field:"optional" json:"maxUnavailable" yaml:"maxUnavailable"` + // An eviction is allowed if at least "minAvailable" pods selected by "selector" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying "100%". + MinAvailable IntOrString `field:"optional" json:"minAvailable" yaml:"minAvailable"` + // Label query over pods whose evictions are managed by the disruption budget. + // + // A null selector will match no pods, while an empty ({}) selector will select all pods within the namespace. + Selector *LabelSelector `field:"optional" json:"selector" yaml:"selector"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodDnsConfig.go b/examples/cdk8s-sample-deployment/imports/k8s/PodDnsConfig.go new file mode 100644 index 0000000..c8c4a4f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodDnsConfig.go @@ -0,0 +1,19 @@ +package k8s + + +// PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy. +type PodDnsConfig struct { + // A list of DNS name server IP addresses. + // + // This will be appended to the base nameservers generated from DNSPolicy. Duplicated nameservers will be removed. + Nameservers *[]*string `field:"optional" json:"nameservers" yaml:"nameservers"` + // A list of DNS resolver options. + // + // This will be merged with the base options generated from DNSPolicy. Duplicated entries will be removed. Resolution options given in Options will override those that appear in the base DNSPolicy. + Options *[]*PodDnsConfigOption `field:"optional" json:"options" yaml:"options"` + // A list of DNS search domains for host-name lookup. + // + // This will be appended to the base search paths generated from DNSPolicy. Duplicated search paths will be removed. + Searches *[]*string `field:"optional" json:"searches" yaml:"searches"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodDnsConfigOption.go b/examples/cdk8s-sample-deployment/imports/k8s/PodDnsConfigOption.go new file mode 100644 index 0000000..727cd9e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodDnsConfigOption.go @@ -0,0 +1,10 @@ +package k8s + + +// PodDNSConfigOption defines DNS resolver options of a pod. +type PodDnsConfigOption struct { + // Required. + Name *string `field:"optional" json:"name" yaml:"name"` + Value *string `field:"optional" json:"value" yaml:"value"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicy.go b/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicy.go new file mode 100644 index 0000000..83fa37c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicy.go @@ -0,0 +1,11 @@ +package k8s + + +// PodFailurePolicy describes how failed pods influence the backoffLimit. +type PodFailurePolicy struct { + // A list of pod failure policy rules. + // + // The rules are evaluated in order. Once a rule matches a Pod failure, the remaining of the rules are ignored. When no rule matches the Pod failure, the default handling applies - the counter of pod failures is incremented and it is checked against the backoffLimit. At most 20 elements are allowed. + Rules *[]*PodFailurePolicyRule `field:"required" json:"rules" yaml:"rules"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicyOnExitCodesRequirement.go b/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicyOnExitCodesRequirement.go new file mode 100644 index 0000000..8a90916 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicyOnExitCodesRequirement.go @@ -0,0 +1,27 @@ +package k8s + + +// PodFailurePolicyOnExitCodesRequirement describes the requirement for handling a failed pod based on its container exit codes. +// +// In particular, it lookups the .state.terminated.exitCode for each app container and init container status, represented by the .status.containerStatuses and .status.initContainerStatuses fields in the Pod status, respectively. Containers completed with success (exit code 0) are excluded from the requirement check. +type PodFailurePolicyOnExitCodesRequirement struct { + // Represents the relationship between the container exit code(s) and the specified values. + // + // Containers completed with success (exit code 0) are excluded from the requirement check. Possible values are: - In: the requirement is satisfied if at least one container exit code + // (might be multiple if there are multiple containers not restricted + // by the 'containerName' field) is in the set of specified values. + // - NotIn: the requirement is satisfied if at least one container exit code + // (might be multiple if there are multiple containers not restricted + // by the 'containerName' field) is not in the set of specified values. + // Additional values are considered to be added in the future. Clients should react to an unknown operator by assuming the requirement is not satisfied. + Operator *string `field:"required" json:"operator" yaml:"operator"` + // Specifies the set of values. + // + // Each returned container exit code (might be multiple in case of multiple containers) is checked against this set of values with respect to the operator. The list of values must be ordered and must not contain duplicates. Value '0' cannot be used for the In operator. At least one element is required. At most 255 elements are allowed. + Values *[]*float64 `field:"required" json:"values" yaml:"values"` + // Restricts the check for exit codes to the container with the specified name. + // + // When null, the rule applies to all containers. When specified, it should match one the container or initContainer names in the pod template. + ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicyOnPodConditionsPattern.go b/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicyOnPodConditionsPattern.go new file mode 100644 index 0000000..e471cee --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicyOnPodConditionsPattern.go @@ -0,0 +1,17 @@ +package k8s + + +// PodFailurePolicyOnPodConditionsPattern describes a pattern for matching an actual pod condition type. +type PodFailurePolicyOnPodConditionsPattern struct { + // Specifies the required Pod condition status. + // + // To match a pod condition it is required that the specified status equals the pod condition status. Defaults to True. + // Default: True. + // + Status *string `field:"required" json:"status" yaml:"status"` + // Specifies the required Pod condition type. + // + // To match a pod condition it is required that specified type equals the pod condition type. + Type *string `field:"required" json:"type" yaml:"type"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicyRule.go b/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicyRule.go new file mode 100644 index 0000000..37145a3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodFailurePolicyRule.go @@ -0,0 +1,25 @@ +package k8s + + +// PodFailurePolicyRule describes how a pod failure is handled when the requirements are met. +// +// One of OnExitCodes and onPodConditions, but not both, can be used in each rule. +type PodFailurePolicyRule struct { + // Specifies the action taken on a pod failure when the requirements are satisfied. + // + // Possible values are: - FailJob: indicates that the pod's job is marked as Failed and all + // running pods are terminated. + // - Ignore: indicates that the counter towards the .backoffLimit is not + // incremented and a replacement pod is created. + // - Count: indicates that the pod is handled in the default way - the + // counter towards the .backoffLimit is incremented. + // Additional values are considered to be added in the future. Clients should react to an unknown action by skipping the rule. + Action *string `field:"required" json:"action" yaml:"action"` + // Represents the requirement on the pod conditions. + // + // The requirement is represented as a list of pod condition patterns. The requirement is satisfied if at least one pattern matches an actual pod condition. At most 20 elements are allowed. + OnPodConditions *[]*PodFailurePolicyOnPodConditionsPattern `field:"required" json:"onPodConditions" yaml:"onPodConditions"` + // Represents the requirement on the container exit codes. + OnExitCodes *PodFailurePolicyOnExitCodesRequirement `field:"optional" json:"onExitCodes" yaml:"onExitCodes"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodOs.go b/examples/cdk8s-sample-deployment/imports/k8s/PodOs.go new file mode 100644 index 0000000..f0c4f4c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodOs.go @@ -0,0 +1,11 @@ +package k8s + + +// PodOS defines the OS parameters of a pod. +type PodOs struct { + // Name is the name of the operating system. + // + // The currently supported values are linux and windows. Additional value may be defined in future and can be one of: https://github.com/opencontainers/runtime-spec/blob/master/config.md#platform-specific-configuration Clients should expect to handle additional values and treat unrecognized values in this field as os: null + Name *string `field:"required" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodReadinessGate.go b/examples/cdk8s-sample-deployment/imports/k8s/PodReadinessGate.go new file mode 100644 index 0000000..eb24a46 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodReadinessGate.go @@ -0,0 +1,9 @@ +package k8s + + +// PodReadinessGate contains the reference to a pod condition. +type PodReadinessGate struct { + // ConditionType refers to a condition in the pod's condition list with matching type. + ConditionType *string `field:"required" json:"conditionType" yaml:"conditionType"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodSecurityContext.go b/examples/cdk8s-sample-deployment/imports/k8s/PodSecurityContext.go new file mode 100644 index 0000000..74e037c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodSecurityContext.go @@ -0,0 +1,55 @@ +package k8s + + +// PodSecurityContext holds pod-level security attributes and common container settings. +// +// Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext. +type PodSecurityContext struct { + // A special supplemental group that applies to all containers in a pod. + // + // Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod: + // + // 1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw---- + // + // If unset, the Kubelet will not modify the ownership and permissions of any volume. Note that this field cannot be set when spec.os.name is windows. + FsGroup *float64 `field:"optional" json:"fsGroup" yaml:"fsGroup"` + // fsGroupChangePolicy defines behavior of changing ownership and permission of the volume before being exposed inside Pod. + // + // This field will only apply to volume types which support fsGroup based ownership(and permissions). It will have no effect on ephemeral volume types such as: secret, configmaps and emptydir. Valid values are "OnRootMismatch" and "Always". If not specified, "Always" is used. Note that this field cannot be set when spec.os.name is windows. + FsGroupChangePolicy *string `field:"optional" json:"fsGroupChangePolicy" yaml:"fsGroupChangePolicy"` + // The GID to run the entrypoint of the container process. + // + // Uses runtime default if unset. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows. + RunAsGroup *float64 `field:"optional" json:"runAsGroup" yaml:"runAsGroup"` + // Indicates that the container must run as a non-root user. + // + // If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + RunAsNonRoot *bool `field:"optional" json:"runAsNonRoot" yaml:"runAsNonRoot"` + // The UID to run the entrypoint of the container process. + // + // Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows. + // Default: user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows. + // + RunAsUser *float64 `field:"optional" json:"runAsUser" yaml:"runAsUser"` + // The seccomp options to use by the containers in this pod. + // + // Note that this field cannot be set when spec.os.name is windows. + SeccompProfile *SeccompProfile `field:"optional" json:"seccompProfile" yaml:"seccompProfile"` + // The SELinux context to be applied to all containers. + // + // If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows. + SeLinuxOptions *SeLinuxOptions `field:"optional" json:"seLinuxOptions" yaml:"seLinuxOptions"` + // A list of groups applied to the first process run in each container, in addition to the container's primary GID. + // + // If unspecified, no groups will be added to any container. Note that this field cannot be set when spec.os.name is windows. + SupplementalGroups *[]*float64 `field:"optional" json:"supplementalGroups" yaml:"supplementalGroups"` + // Sysctls hold a list of namespaced sysctls used for the pod. + // + // Pods with unsupported sysctls (by the container runtime) might fail to launch. Note that this field cannot be set when spec.os.name is windows. + Sysctls *[]*Sysctl `field:"optional" json:"sysctls" yaml:"sysctls"` + // The Windows specific settings applied to all containers. + // + // If unspecified, the options within a container's SecurityContext will be used. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is linux. + WindowsOptions *WindowsSecurityContextOptions `field:"optional" json:"windowsOptions" yaml:"windowsOptions"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/PodSpec.go new file mode 100644 index 0000000..bdc4b1d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodSpec.go @@ -0,0 +1,171 @@ +package k8s + + +// PodSpec is a description of a pod. +type PodSpec struct { + // List of containers belonging to the pod. + // + // Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated. + Containers *[]*Container `field:"required" json:"containers" yaml:"containers"` + // Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. + // + // Value must be a positive integer. + ActiveDeadlineSeconds *float64 `field:"optional" json:"activeDeadlineSeconds" yaml:"activeDeadlineSeconds"` + // If specified, the pod's scheduling constraints. + Affinity *Affinity `field:"optional" json:"affinity" yaml:"affinity"` + // AutomountServiceAccountToken indicates whether a service account token should be automatically mounted. + AutomountServiceAccountToken *bool `field:"optional" json:"automountServiceAccountToken" yaml:"automountServiceAccountToken"` + // Specifies the DNS parameters of a pod. + // + // Parameters specified here will be merged to the generated DNS configuration based on DNSPolicy. + DnsConfig *PodDnsConfig `field:"optional" json:"dnsConfig" yaml:"dnsConfig"` + // Set DNS policy for the pod. + // + // Defaults to "ClusterFirst". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'. + // Default: ClusterFirst". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'. + // + DnsPolicy *string `field:"optional" json:"dnsPolicy" yaml:"dnsPolicy"` + // EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. + // + // Optional: Defaults to true. + // Default: true. + // + EnableServiceLinks *bool `field:"optional" json:"enableServiceLinks" yaml:"enableServiceLinks"` + // List of ephemeral containers run in this pod. + // + // Ephemeral containers may be run in an existing pod to perform user-initiated actions such as debugging. This list cannot be specified when creating a pod, and it cannot be modified by updating the pod spec. In order to add an ephemeral container to an existing pod, use the pod's ephemeralcontainers subresource. + EphemeralContainers *[]*EphemeralContainer `field:"optional" json:"ephemeralContainers" yaml:"ephemeralContainers"` + // HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + // + // This is only valid for non-hostNetwork pods. + HostAliases *[]*HostAlias `field:"optional" json:"hostAliases" yaml:"hostAliases"` + // Use the host's ipc namespace. + // + // Optional: Default to false. + // Default: false. + // + HostIpc *bool `field:"optional" json:"hostIpc" yaml:"hostIpc"` + // Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value. + Hostname *string `field:"optional" json:"hostname" yaml:"hostname"` + // Host networking requested for this pod. + // + // Use the host's network namespace. If this option is set, the ports that will be used must be specified. Default to false. + // Default: false. + // + HostNetwork *bool `field:"optional" json:"hostNetwork" yaml:"hostNetwork"` + // Use the host's pid namespace. + // + // Optional: Default to false. + // Default: false. + // + HostPid *bool `field:"optional" json:"hostPid" yaml:"hostPid"` + // Use the host's user namespace. + // + // Optional: Default to true. If set to true or not present, the pod will be run in the host user namespace, useful for when the pod needs a feature only available to the host user namespace, such as loading a kernel module with CAP_SYS_MODULE. When set to false, a new userns is created for the pod. Setting false is useful for mitigating container breakout vulnerabilities even allowing users to run their containers as root without actually having root privileges on the host. This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature. + // Default: true. If set to true or not present, the pod will be run in the host user namespace, useful for when the pod needs a feature only available to the host user namespace, such as loading a kernel module with CAP_SYS_MODULE. When set to false, a new userns is created for the pod. Setting false is useful for mitigating container breakout vulnerabilities even allowing users to run their containers as root without actually having root privileges on the host. This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature. + // + HostUsers *bool `field:"optional" json:"hostUsers" yaml:"hostUsers"` + // ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. + // + // If specified, these secrets will be passed to individual puller implementations for them to use. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod + ImagePullSecrets *[]*LocalObjectReference `field:"optional" json:"imagePullSecrets" yaml:"imagePullSecrets"` + // List of initialization containers belonging to the pod. + // + // Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ + InitContainers *[]*Container `field:"optional" json:"initContainers" yaml:"initContainers"` + // NodeName is a request to schedule this pod onto a specific node. + // + // If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements. + NodeName *string `field:"optional" json:"nodeName" yaml:"nodeName"` + // NodeSelector is a selector which must be true for the pod to fit on a node. + // + // Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + NodeSelector *map[string]*string `field:"optional" json:"nodeSelector" yaml:"nodeSelector"` + // Specifies the OS of the containers in the pod. + // + // Some pod and container fields are restricted if this is set. + // + // If the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions + // + // If the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.hostUsers - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile - spec.containers[*].securityContext.capabilities - spec.containers[*].securityContext.readOnlyRootFilesystem - spec.containers[*].securityContext.privileged - spec.containers[*].securityContext.allowPrivilegeEscalation - spec.containers[*].securityContext.procMount - spec.containers[*].securityContext.runAsUser - spec.containers[*].securityContext.runAsGroup + Os *PodOs `field:"optional" json:"os" yaml:"os"` + // Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. + // + // This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md + Overhead *map[string]Quantity `field:"optional" json:"overhead" yaml:"overhead"` + // PreemptionPolicy is the Policy for preempting pods with lower priority. + // + // One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + // Default: PreemptLowerPriority if unset. + // + PreemptionPolicy *string `field:"optional" json:"preemptionPolicy" yaml:"preemptionPolicy"` + // The priority value. + // + // Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. + Priority *float64 `field:"optional" json:"priority" yaml:"priority"` + // If specified, indicates the pod's priority. + // + // "system-node-critical" and "system-cluster-critical" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default. + PriorityClassName *string `field:"optional" json:"priorityClassName" yaml:"priorityClassName"` + // If specified, all readiness gates will be evaluated for pod readiness. + // + // A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to "True" More info: https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates + ReadinessGates *[]*PodReadinessGate `field:"optional" json:"readinessGates" yaml:"readinessGates"` + // Restart policy for all containers within the pod. + // + // One of Always, OnFailure, Never. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy + // Default: Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy + // + RestartPolicy *string `field:"optional" json:"restartPolicy" yaml:"restartPolicy"` + // RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class. + RuntimeClassName *string `field:"optional" json:"runtimeClassName" yaml:"runtimeClassName"` + // If specified, the pod will be dispatched by specified scheduler. + // + // If not specified, the pod will be dispatched by default scheduler. + SchedulerName *string `field:"optional" json:"schedulerName" yaml:"schedulerName"` + // SecurityContext holds pod-level security attributes and common container settings. + // + // Optional: Defaults to empty. See type description for default values of each field. + // Default: empty. See type description for default values of each field. + // + SecurityContext *PodSecurityContext `field:"optional" json:"securityContext" yaml:"securityContext"` + // DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. + // + // Deprecated: Use serviceAccountName instead. + ServiceAccount *string `field:"optional" json:"serviceAccount" yaml:"serviceAccount"` + // ServiceAccountName is the name of the ServiceAccount to use to run this pod. + // + // More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ + ServiceAccountName *string `field:"optional" json:"serviceAccountName" yaml:"serviceAccountName"` + // If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default). + // + // In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters to FQDN. If a pod does not have FQDN, this has no effect. Default to false. + // Default: false. + // + SetHostnameAsFqdn *bool `field:"optional" json:"setHostnameAsFqdn" yaml:"setHostnameAsFqdn"` + // Share a single process namespace between all of the containers in a pod. + // + // When this is set containers will be able to view and signal processes from other containers in the same pod, and the first process in each container will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both be set. Optional: Default to false. + // Default: false. + // + ShareProcessNamespace *bool `field:"optional" json:"shareProcessNamespace" yaml:"shareProcessNamespace"` + // If specified, the fully qualified Pod hostname will be "...svc.". If not specified, the pod will not have a domainname at all. + Subdomain *string `field:"optional" json:"subdomain" yaml:"subdomain"` + // Optional duration in seconds the pod needs to terminate gracefully. + // + // May be decreased in delete request. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds. + // Default: 30 seconds. + // + TerminationGracePeriodSeconds *float64 `field:"optional" json:"terminationGracePeriodSeconds" yaml:"terminationGracePeriodSeconds"` + // If specified, the pod's tolerations. + Tolerations *[]*Toleration `field:"optional" json:"tolerations" yaml:"tolerations"` + // TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. + // + // Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed. + TopologySpreadConstraints *[]*TopologySpreadConstraint `field:"optional" json:"topologySpreadConstraints" yaml:"topologySpreadConstraints"` + // List of volumes that can be mounted by containers belonging to the pod. + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes + Volumes *[]*Volume `field:"optional" json:"volumes" yaml:"volumes"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodTemplateSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/PodTemplateSpec.go new file mode 100644 index 0000000..021a66a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodTemplateSpec.go @@ -0,0 +1,15 @@ +package k8s + + +// PodTemplateSpec describes the data a pod should have when created from a template. +type PodTemplateSpec struct { + // Standard object's metadata. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + Metadata *ObjectMeta `field:"optional" json:"metadata" yaml:"metadata"` + // Specification of the desired behavior of the pod. + // + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec *PodSpec `field:"optional" json:"spec" yaml:"spec"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodsMetricSourceV2.go b/examples/cdk8s-sample-deployment/imports/k8s/PodsMetricSourceV2.go new file mode 100644 index 0000000..55a8845 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodsMetricSourceV2.go @@ -0,0 +1,13 @@ +package k8s + + +// PodsMetricSource indicates how to scale on a metric describing each pod in the current scale target (for example, transactions-processed-per-second). +// +// The values will be averaged together before being compared to the target value. +type PodsMetricSourceV2 struct { + // metric identifies the target metric by name and selector. + Metric *MetricIdentifierV2 `field:"required" json:"metric" yaml:"metric"` + // target specifies the target value for the given metric. + Target *MetricTargetV2 `field:"required" json:"target" yaml:"target"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PodsMetricSourceV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/PodsMetricSourceV2Beta2.go new file mode 100644 index 0000000..09b86ba --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PodsMetricSourceV2Beta2.go @@ -0,0 +1,13 @@ +package k8s + + +// PodsMetricSource indicates how to scale on a metric describing each pod in the current scale target (for example, transactions-processed-per-second). +// +// The values will be averaged together before being compared to the target value. +type PodsMetricSourceV2Beta2 struct { + // metric identifies the target metric by name and selector. + Metric *MetricIdentifierV2Beta2 `field:"required" json:"metric" yaml:"metric"` + // target specifies the target value for the given metric. + Target *MetricTargetV2Beta2 `field:"required" json:"target" yaml:"target"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PolicyRule.go b/examples/cdk8s-sample-deployment/imports/k8s/PolicyRule.go new file mode 100644 index 0000000..82b853c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PolicyRule.go @@ -0,0 +1,27 @@ +package k8s + + +// PolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to. +type PolicyRule struct { + // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. + // + // '*' represents all verbs. + Verbs *[]*string `field:"required" json:"verbs" yaml:"verbs"` + // APIGroups is the name of the APIGroup that contains the resources. + // + // If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. + ApiGroups *[]*string `field:"optional" json:"apiGroups" yaml:"apiGroups"` + // NonResourceURLs is a set of partial urls that a user should have access to. + // + // *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. + NonResourceUrLs *[]*string `field:"optional" json:"nonResourceUrLs" yaml:"nonResourceUrLs"` + // ResourceNames is an optional white list of names that the rule applies to. + // + // An empty set means that everything is allowed. + ResourceNames *[]*string `field:"optional" json:"resourceNames" yaml:"resourceNames"` + // Resources is a list of resources this rule applies to. + // + // '*' represents all resources. + Resources *[]*string `field:"optional" json:"resources" yaml:"resources"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PolicyRulesWithSubjectsV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/PolicyRulesWithSubjectsV1Beta1.go new file mode 100644 index 0000000..6f65543 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PolicyRulesWithSubjectsV1Beta1.go @@ -0,0 +1,19 @@ +package k8s + + +// PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. +// +// The test considers the subject making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member of resourceRules or nonResourceRules matches the request. +type PolicyRulesWithSubjectsV1Beta1 struct { + // subjects is the list of normal user, serviceaccount, or group that this rule cares about. + // + // There must be at least one member in this slice. A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. Required. + Subjects *[]*SubjectV1Beta1 `field:"required" json:"subjects" yaml:"subjects"` + // `nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb and the target non-resource URL. + NonResourceRules *[]*NonResourcePolicyRuleV1Beta1 `field:"optional" json:"nonResourceRules" yaml:"nonResourceRules"` + // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the target resource. + // + // At least one of `resourceRules` and `nonResourceRules` has to be non-empty. + ResourceRules *[]*ResourcePolicyRuleV1Beta1 `field:"optional" json:"resourceRules" yaml:"resourceRules"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PolicyRulesWithSubjectsV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/PolicyRulesWithSubjectsV1Beta2.go new file mode 100644 index 0000000..9d815b3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PolicyRulesWithSubjectsV1Beta2.go @@ -0,0 +1,19 @@ +package k8s + + +// PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. +// +// The test considers the subject making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member of resourceRules or nonResourceRules matches the request. +type PolicyRulesWithSubjectsV1Beta2 struct { + // subjects is the list of normal user, serviceaccount, or group that this rule cares about. + // + // There must be at least one member in this slice. A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. Required. + Subjects *[]*SubjectV1Beta2 `field:"required" json:"subjects" yaml:"subjects"` + // `nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb and the target non-resource URL. + NonResourceRules *[]*NonResourcePolicyRuleV1Beta2 `field:"optional" json:"nonResourceRules" yaml:"nonResourceRules"` + // `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the target resource. + // + // At least one of `resourceRules` and `nonResourceRules` has to be non-empty. + ResourceRules *[]*ResourcePolicyRuleV1Beta2 `field:"optional" json:"resourceRules" yaml:"resourceRules"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PortworxVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/PortworxVolumeSource.go new file mode 100644 index 0000000..5cc4a4a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PortworxVolumeSource.go @@ -0,0 +1,17 @@ +package k8s + + +// PortworxVolumeSource represents a Portworx volume resource. +type PortworxVolumeSource struct { + // volumeID uniquely identifies a Portworx volume. + VolumeId *string `field:"required" json:"volumeId" yaml:"volumeId"` + // fSType represents the filesystem type to mount Must be a filesystem type supported by the host operating system. + // + // Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // readOnly defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Preconditions.go b/examples/cdk8s-sample-deployment/imports/k8s/Preconditions.go new file mode 100644 index 0000000..12cffa0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Preconditions.go @@ -0,0 +1,11 @@ +package k8s + + +// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out. +type Preconditions struct { + // Specifies the target ResourceVersion. + ResourceVersion *string `field:"optional" json:"resourceVersion" yaml:"resourceVersion"` + // Specifies the target UID. + Uid *string `field:"optional" json:"uid" yaml:"uid"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PreferredSchedulingTerm.go b/examples/cdk8s-sample-deployment/imports/k8s/PreferredSchedulingTerm.go new file mode 100644 index 0000000..82e287d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PreferredSchedulingTerm.go @@ -0,0 +1,11 @@ +package k8s + + +// An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). +type PreferredSchedulingTerm struct { + // A node selector term, associated with the corresponding weight. + Preference *NodeSelectorTerm `field:"required" json:"preference" yaml:"preference"` + // Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. + Weight *float64 `field:"required" json:"weight" yaml:"weight"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationReferenceV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationReferenceV1Beta1.go new file mode 100644 index 0000000..26da80a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationReferenceV1Beta1.go @@ -0,0 +1,9 @@ +package k8s + + +// PriorityLevelConfigurationReference contains information that points to the "request-priority" being used. +type PriorityLevelConfigurationReferenceV1Beta1 struct { + // `name` is the name of the priority level configuration being referenced Required. + Name *string `field:"required" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationReferenceV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationReferenceV1Beta2.go new file mode 100644 index 0000000..61178f5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationReferenceV1Beta2.go @@ -0,0 +1,9 @@ +package k8s + + +// PriorityLevelConfigurationReference contains information that points to the "request-priority" being used. +type PriorityLevelConfigurationReferenceV1Beta2 struct { + // `name` is the name of the priority level configuration being referenced Required. + Name *string `field:"required" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationSpecV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationSpecV1Beta1.go new file mode 100644 index 0000000..484edb1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationSpecV1Beta1.go @@ -0,0 +1,15 @@ +package k8s + + +// PriorityLevelConfigurationSpec specifies the configuration of a priority level. +type PriorityLevelConfigurationSpecV1Beta1 struct { + // `type` indicates whether this priority level is subject to limitation on request execution. + // + // A value of `"Exempt"` means that requests of this priority level are not subject to a limit (and thus are never queued) and do not detract from the capacity made available to other priority levels. A value of `"Limited"` means that (a) requests of this priority level _are_ subject to limits and (b) some of the server's limited capacity is made available exclusively to this priority level. Required. + Type *string `field:"required" json:"type" yaml:"type"` + // `limited` specifies how requests are handled for a Limited priority level. + // + // This field must be non-empty if and only if `type` is `"Limited"`. + Limited *LimitedPriorityLevelConfigurationV1Beta1 `field:"optional" json:"limited" yaml:"limited"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationSpecV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationSpecV1Beta2.go new file mode 100644 index 0000000..de40c0f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/PriorityLevelConfigurationSpecV1Beta2.go @@ -0,0 +1,15 @@ +package k8s + + +// PriorityLevelConfigurationSpec specifies the configuration of a priority level. +type PriorityLevelConfigurationSpecV1Beta2 struct { + // `type` indicates whether this priority level is subject to limitation on request execution. + // + // A value of `"Exempt"` means that requests of this priority level are not subject to a limit (and thus are never queued) and do not detract from the capacity made available to other priority levels. A value of `"Limited"` means that (a) requests of this priority level _are_ subject to limits and (b) some of the server's limited capacity is made available exclusively to this priority level. Required. + Type *string `field:"required" json:"type" yaml:"type"` + // `limited` specifies how requests are handled for a Limited priority level. + // + // This field must be non-empty if and only if `type` is `"Limited"`. + Limited *LimitedPriorityLevelConfigurationV1Beta2 `field:"optional" json:"limited" yaml:"limited"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Probe.go b/examples/cdk8s-sample-deployment/imports/k8s/Probe.go new file mode 100644 index 0000000..1720767 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Probe.go @@ -0,0 +1,49 @@ +package k8s + + +// Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. +type Probe struct { + // Exec specifies the action to take. + Exec *ExecAction `field:"optional" json:"exec" yaml:"exec"` + // Minimum consecutive failures for the probe to be considered failed after having succeeded. + // + // Defaults to 3. Minimum value is 1. + // Default: 3. Minimum value is 1. + // + FailureThreshold *float64 `field:"optional" json:"failureThreshold" yaml:"failureThreshold"` + // GRPC specifies an action involving a GRPC port. + // + // This is a beta field and requires enabling GRPCContainerProbe feature gate. + Grpc *GrpcAction `field:"optional" json:"grpc" yaml:"grpc"` + // HTTPGet specifies the http request to perform. + HttpGet *HttpGetAction `field:"optional" json:"httpGet" yaml:"httpGet"` + // Number of seconds after the container has started before liveness probes are initiated. + // + // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + InitialDelaySeconds *float64 `field:"optional" json:"initialDelaySeconds" yaml:"initialDelaySeconds"` + // How often (in seconds) to perform the probe. + // + // Default to 10 seconds. Minimum value is 1. + // Default: 10 seconds. Minimum value is 1. + // + PeriodSeconds *float64 `field:"optional" json:"periodSeconds" yaml:"periodSeconds"` + // Minimum consecutive successes for the probe to be considered successful after having failed. + // + // Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + // Default: 1. Must be 1 for liveness and startup. Minimum value is 1. + // + SuccessThreshold *float64 `field:"optional" json:"successThreshold" yaml:"successThreshold"` + // TCPSocket specifies an action involving a TCP port. + TcpSocket *TcpSocketAction `field:"optional" json:"tcpSocket" yaml:"tcpSocket"` + // Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + // + // The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. + TerminationGracePeriodSeconds *float64 `field:"optional" json:"terminationGracePeriodSeconds" yaml:"terminationGracePeriodSeconds"` + // Number of seconds after which the probe times out. + // + // Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + // Default: 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + // + TimeoutSeconds *float64 `field:"optional" json:"timeoutSeconds" yaml:"timeoutSeconds"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ProjectedVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/ProjectedVolumeSource.go new file mode 100644 index 0000000..984fbc6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ProjectedVolumeSource.go @@ -0,0 +1,13 @@ +package k8s + + +// Represents a projected volume source. +type ProjectedVolumeSource struct { + // defaultMode are the mode bits used to set permissions on created files by default. + // + // Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + DefaultMode *float64 `field:"optional" json:"defaultMode" yaml:"defaultMode"` + // sources is the list of volume projections. + Sources *[]*VolumeProjection `field:"optional" json:"sources" yaml:"sources"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Quantity.go b/examples/cdk8s-sample-deployment/imports/k8s/Quantity.go new file mode 100644 index 0000000..1012b14 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Quantity.go @@ -0,0 +1,63 @@ +package k8s + +import ( + _init_ "example.com/cdk8s-test/imports/k8s/jsii" + _jsii_ "github.com/aws/jsii-runtime-go/runtime" +) + +type Quantity interface { + Value() interface{} +} + +// The jsii proxy struct for Quantity +type jsiiProxy_Quantity struct { + _ byte // padding +} + +func (j *jsiiProxy_Quantity) Value() interface{} { + var returns interface{} + _jsii_.Get( + j, + "value", + &returns, + ) + return returns +} + + +func Quantity_FromNumber(value *float64) Quantity { + _init_.Initialize() + + if err := validateQuantity_FromNumberParameters(value); err != nil { + panic(err) + } + var returns Quantity + + _jsii_.StaticInvoke( + "k8s.Quantity", + "fromNumber", + []interface{}{value}, + &returns, + ) + + return returns +} + +func Quantity_FromString(value *string) Quantity { + _init_.Initialize() + + if err := validateQuantity_FromStringParameters(value); err != nil { + panic(err) + } + var returns Quantity + + _jsii_.StaticInvoke( + "k8s.Quantity", + "fromString", + []interface{}{value}, + &returns, + ) + + return returns +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Quantity__checks.go b/examples/cdk8s-sample-deployment/imports/k8s/Quantity__checks.go new file mode 100644 index 0000000..147c205 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Quantity__checks.go @@ -0,0 +1,24 @@ +//go:build !no_runtime_type_checking + +package k8s + +import ( + "fmt" +) + +func validateQuantity_FromNumberParameters(value *float64) error { + if value == nil { + return fmt.Errorf("parameter value is required, but nil was provided") + } + + return nil +} + +func validateQuantity_FromStringParameters(value *string) error { + if value == nil { + return fmt.Errorf("parameter value is required, but nil was provided") + } + + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Quantity__no_checks.go b/examples/cdk8s-sample-deployment/imports/k8s/Quantity__no_checks.go new file mode 100644 index 0000000..28a80f5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Quantity__no_checks.go @@ -0,0 +1,14 @@ +//go:build no_runtime_type_checking + +package k8s + +// Building without runtime type checking enabled, so all the below just return nil + +func validateQuantity_FromNumberParameters(value *float64) error { + return nil +} + +func validateQuantity_FromStringParameters(value *string) error { + return nil +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/QueuingConfigurationV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/QueuingConfigurationV1Beta1.go new file mode 100644 index 0000000..f7fc5b4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/QueuingConfigurationV1Beta1.go @@ -0,0 +1,19 @@ +package k8s + + +// QueuingConfiguration holds the configuration parameters for queuing. +type QueuingConfigurationV1Beta1 struct { + // `handSize` is a small positive number that configures the shuffle sharding of requests into queues. + // + // When enqueuing a request at this priority level the request's flow identifier (a string pair) is hashed and the hash value is used to shuffle the list of queues and deal a hand of the size specified here. The request is put into one of the shortest queues in that hand. `handSize` must be no larger than `queues`, and should be significantly smaller (so that a few heavy flows do not saturate most of the queues). See the user-facing documentation for more extensive guidance on setting this field. This field has a default value of 8. + HandSize *float64 `field:"optional" json:"handSize" yaml:"handSize"` + // `queueLengthLimit` is the maximum number of requests allowed to be waiting in a given queue of this priority level at a time; + // + // excess requests are rejected. This value must be positive. If not specified, it will be defaulted to 50. + QueueLengthLimit *float64 `field:"optional" json:"queueLengthLimit" yaml:"queueLengthLimit"` + // `queues` is the number of queues for this priority level. + // + // The queues exist independently at each apiserver. The value must be positive. Setting it to 1 effectively precludes shufflesharding and thus makes the distinguisher method of associated flow schemas irrelevant. This field has a default value of 64. + Queues *float64 `field:"optional" json:"queues" yaml:"queues"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/QueuingConfigurationV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/QueuingConfigurationV1Beta2.go new file mode 100644 index 0000000..24c6bc4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/QueuingConfigurationV1Beta2.go @@ -0,0 +1,19 @@ +package k8s + + +// QueuingConfiguration holds the configuration parameters for queuing. +type QueuingConfigurationV1Beta2 struct { + // `handSize` is a small positive number that configures the shuffle sharding of requests into queues. + // + // When enqueuing a request at this priority level the request's flow identifier (a string pair) is hashed and the hash value is used to shuffle the list of queues and deal a hand of the size specified here. The request is put into one of the shortest queues in that hand. `handSize` must be no larger than `queues`, and should be significantly smaller (so that a few heavy flows do not saturate most of the queues). See the user-facing documentation for more extensive guidance on setting this field. This field has a default value of 8. + HandSize *float64 `field:"optional" json:"handSize" yaml:"handSize"` + // `queueLengthLimit` is the maximum number of requests allowed to be waiting in a given queue of this priority level at a time; + // + // excess requests are rejected. This value must be positive. If not specified, it will be defaulted to 50. + QueueLengthLimit *float64 `field:"optional" json:"queueLengthLimit" yaml:"queueLengthLimit"` + // `queues` is the number of queues for this priority level. + // + // The queues exist independently at each apiserver. The value must be positive. Setting it to 1 effectively precludes shufflesharding and thus makes the distinguisher method of associated flow schemas irrelevant. This field has a default value of 64. + Queues *float64 `field:"optional" json:"queues" yaml:"queues"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/QuobyteVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/QuobyteVolumeSource.go new file mode 100644 index 0000000..79e2ba2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/QuobyteVolumeSource.go @@ -0,0 +1,29 @@ +package k8s + + +// Represents a Quobyte mount that lasts the lifetime of a pod. +// +// Quobyte volumes do not support ownership management or SELinux relabeling. +type QuobyteVolumeSource struct { + // registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes. + Registry *string `field:"required" json:"registry" yaml:"registry"` + // volume is a string that references an already created Quobyte volume by name. + Volume *string `field:"required" json:"volume" yaml:"volume"` + // group to map volume access to Default is no group. + // Default: no group. + // + Group *string `field:"optional" json:"group" yaml:"group"` + // readOnly here will force the Quobyte volume to be mounted with read-only permissions. + // + // Defaults to false. + // Default: false. + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // tenant owning the given Quobyte volume in the Backend Used with dynamically provisioned Quobyte volumes, value is set by the plugin. + Tenant *string `field:"optional" json:"tenant" yaml:"tenant"` + // user to map volume access to Defaults to serivceaccount user. + // Default: serivceaccount user. + // + User *string `field:"optional" json:"user" yaml:"user"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/RbdPersistentVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/RbdPersistentVolumeSource.go new file mode 100644 index 0000000..67171dd --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/RbdPersistentVolumeSource.go @@ -0,0 +1,51 @@ +package k8s + + +// Represents a Rados Block Device mount that lasts the lifetime of a pod. +// +// RBD volumes support ownership management and SELinux relabeling. +type RbdPersistentVolumeSource struct { + // image is the rados image name. + // + // More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + Image *string `field:"required" json:"image" yaml:"image"` + // monitors is a collection of Ceph monitors. + // + // More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + Monitors *[]*string `field:"required" json:"monitors" yaml:"monitors"` + // fsType is the filesystem type of the volume that you want to mount. + // + // Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // keyring is the path to key ring for RBDUser. + // + // Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // Default: etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // + Keyring *string `field:"optional" json:"keyring" yaml:"keyring"` + // pool is the rados pool name. + // + // Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // Default: rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // + Pool *string `field:"optional" json:"pool" yaml:"pool"` + // readOnly here will force the ReadOnly setting in VolumeMounts. + // + // Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // Default: false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretRef is name of the authentication secret for RBDUser. + // + // If provided overrides keyring. Default is nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // Default: nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // + SecretRef *SecretReference `field:"optional" json:"secretRef" yaml:"secretRef"` + // user is the rados user name. + // + // Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // Default: admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // + User *string `field:"optional" json:"user" yaml:"user"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/RbdVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/RbdVolumeSource.go new file mode 100644 index 0000000..f9810fa --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/RbdVolumeSource.go @@ -0,0 +1,51 @@ +package k8s + + +// Represents a Rados Block Device mount that lasts the lifetime of a pod. +// +// RBD volumes support ownership management and SELinux relabeling. +type RbdVolumeSource struct { + // image is the rados image name. + // + // More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + Image *string `field:"required" json:"image" yaml:"image"` + // monitors is a collection of Ceph monitors. + // + // More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + Monitors *[]*string `field:"required" json:"monitors" yaml:"monitors"` + // fsType is the filesystem type of the volume that you want to mount. + // + // Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // keyring is the path to key ring for RBDUser. + // + // Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // Default: etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // + Keyring *string `field:"optional" json:"keyring" yaml:"keyring"` + // pool is the rados pool name. + // + // Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // Default: rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // + Pool *string `field:"optional" json:"pool" yaml:"pool"` + // readOnly here will force the ReadOnly setting in VolumeMounts. + // + // Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // Default: false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretRef is name of the authentication secret for RBDUser. + // + // If provided overrides keyring. Default is nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // Default: nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // + SecretRef *LocalObjectReference `field:"optional" json:"secretRef" yaml:"secretRef"` + // user is the rados user name. + // + // Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // Default: admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + // + User *string `field:"optional" json:"user" yaml:"user"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ReplicaSetSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/ReplicaSetSpec.go new file mode 100644 index 0000000..30ed2ce --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ReplicaSetSpec.go @@ -0,0 +1,27 @@ +package k8s + + +// ReplicaSetSpec is the specification of a ReplicaSet. +type ReplicaSetSpec struct { + // Selector is a label query over pods that should match the replica count. + // + // Label keys and values that must match in order to be controlled by this replica set. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector *LabelSelector `field:"required" json:"selector" yaml:"selector"` + // Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. + // + // Defaults to 0 (pod will be considered available as soon as it is ready). + // Default: 0 (pod will be considered available as soon as it is ready). + // + MinReadySeconds *float64 `field:"optional" json:"minReadySeconds" yaml:"minReadySeconds"` + // Replicas is the number of desired replicas. + // + // This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller + // Default: 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller + // + Replicas *float64 `field:"optional" json:"replicas" yaml:"replicas"` + // Template is the object that describes the pod that will be created if insufficient replicas are detected. + // + // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + Template *PodTemplateSpec `field:"optional" json:"template" yaml:"template"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ReplicationControllerSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/ReplicationControllerSpec.go new file mode 100644 index 0000000..6533d1b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ReplicationControllerSpec.go @@ -0,0 +1,27 @@ +package k8s + + +// ReplicationControllerSpec is the specification of a replication controller. +type ReplicationControllerSpec struct { + // Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. + // + // Defaults to 0 (pod will be considered available as soon as it is ready). + // Default: 0 (pod will be considered available as soon as it is ready). + // + MinReadySeconds *float64 `field:"optional" json:"minReadySeconds" yaml:"minReadySeconds"` + // Replicas is the number of desired replicas. + // + // This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller + // Default: 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller + // + Replicas *float64 `field:"optional" json:"replicas" yaml:"replicas"` + // Selector is a label query over pods that should match the Replicas count. + // + // If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this replication controller, if empty defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector *map[string]*string `field:"optional" json:"selector" yaml:"selector"` + // Template is the object that describes the pod that will be created if insufficient replicas are detected. + // + // This takes precedence over a TemplateRef. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + Template *PodTemplateSpec `field:"optional" json:"template" yaml:"template"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ResourceAttributes.go b/examples/cdk8s-sample-deployment/imports/k8s/ResourceAttributes.go new file mode 100644 index 0000000..2beba2f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ResourceAttributes.go @@ -0,0 +1,35 @@ +package k8s + + +// ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface. +type ResourceAttributes struct { + // Group is the API Group of the Resource. + // + // "*" means all. + Group *string `field:"optional" json:"group" yaml:"group"` + // Name is the name of the resource being requested for a "get" or deleted for a "delete". + // + // "" (empty) means all. + Name *string `field:"optional" json:"name" yaml:"name"` + // Namespace is the namespace of the action being requested. + // + // Currently, there is no distinction between no namespace and all namespaces "" (empty) is defaulted for LocalSubjectAccessReviews "" (empty) is empty for cluster-scoped resources "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview. + Namespace *string `field:"optional" json:"namespace" yaml:"namespace"` + // Resource is one of the existing resource types. + // + // "*" means all. + Resource *string `field:"optional" json:"resource" yaml:"resource"` + // Subresource is one of the existing resource types. + // + // "" means none. + Subresource *string `field:"optional" json:"subresource" yaml:"subresource"` + // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. + // + // "*" means all. + Verb *string `field:"optional" json:"verb" yaml:"verb"` + // Version is the API Version of the Resource. + // + // "*" means all. + Version *string `field:"optional" json:"version" yaml:"version"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ResourceFieldSelector.go b/examples/cdk8s-sample-deployment/imports/k8s/ResourceFieldSelector.go new file mode 100644 index 0000000..46b5bbf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ResourceFieldSelector.go @@ -0,0 +1,13 @@ +package k8s + + +// ResourceFieldSelector represents container resources (cpu, memory) and their output format. +type ResourceFieldSelector struct { + // Required: resource to select. + Resource *string `field:"required" json:"resource" yaml:"resource"` + // Container name: required for volumes, optional for env vars. + ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` + // Specifies the output format of the exposed resources, defaults to "1". + Divisor Quantity `field:"optional" json:"divisor" yaml:"divisor"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ResourceMetricSourceV2.go b/examples/cdk8s-sample-deployment/imports/k8s/ResourceMetricSourceV2.go new file mode 100644 index 0000000..fd38783 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ResourceMetricSourceV2.go @@ -0,0 +1,11 @@ +package k8s + + +// ResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. Only one "target" type should be set. +type ResourceMetricSourceV2 struct { + // name is the name of the resource in question. + Name *string `field:"required" json:"name" yaml:"name"` + // target specifies the target value for the given metric. + Target *MetricTargetV2 `field:"required" json:"target" yaml:"target"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ResourceMetricSourceV2Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/ResourceMetricSourceV2Beta2.go new file mode 100644 index 0000000..cceb88f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ResourceMetricSourceV2Beta2.go @@ -0,0 +1,11 @@ +package k8s + + +// ResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. Only one "target" type should be set. +type ResourceMetricSourceV2Beta2 struct { + // name is the name of the resource in question. + Name *string `field:"required" json:"name" yaml:"name"` + // target specifies the target value for the given metric. + Target *MetricTargetV2Beta2 `field:"required" json:"target" yaml:"target"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ResourcePolicyRuleV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/ResourcePolicyRuleV1Beta1.go new file mode 100644 index 0000000..b3acf5d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ResourcePolicyRuleV1Beta1.go @@ -0,0 +1,27 @@ +package k8s + + +// ResourcePolicyRule is a predicate that matches some resource requests, testing the request's verb and the target resource. +// +// A ResourcePolicyRule matches a resource request if and only if: (a) at least one member of verbs matches the request, (b) at least one member of apiGroups matches the request, (c) at least one member of resources matches the request, and (d) either (d1) the request does not specify a namespace (i.e., `Namespace==""`) and clusterScope is true or (d2) the request specifies a namespace and least one member of namespaces matches the request's namespace. +type ResourcePolicyRuleV1Beta1 struct { + // `apiGroups` is a list of matching API groups and may not be empty. + // + // "*" matches all API groups and, if present, must be the only entry. Required. + ApiGroups *[]*string `field:"required" json:"apiGroups" yaml:"apiGroups"` + // `resources` is a list of matching resources (i.e., lowercase and plural) with, if desired, subresource. For example, [ "services", "nodes/status" ]. This list may not be empty. "*" matches all resources and, if present, must be the only entry. Required. + Resources *[]*string `field:"required" json:"resources" yaml:"resources"` + // `verbs` is a list of matching verbs and may not be empty. + // + // "*" matches all verbs and, if present, must be the only entry. Required. + Verbs *[]*string `field:"required" json:"verbs" yaml:"verbs"` + // `clusterScope` indicates whether to match requests that do not specify a namespace (which happens either because the resource is not namespaced or the request targets all namespaces). + // + // If this field is omitted or false then the `namespaces` field must contain a non-empty list. + ClusterScope *bool `field:"optional" json:"clusterScope" yaml:"clusterScope"` + // `namespaces` is a list of target namespaces that restricts matches. + // + // A request that specifies a target namespace matches only if either (a) this list contains that target namespace or (b) this list contains "*". Note that "*" matches any specified namespace but does not match a request that _does not specify_ a namespace (see the `clusterScope` field for that). This list may be empty, but only if `clusterScope` is true. + Namespaces *[]*string `field:"optional" json:"namespaces" yaml:"namespaces"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ResourcePolicyRuleV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/ResourcePolicyRuleV1Beta2.go new file mode 100644 index 0000000..e7c0bc9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ResourcePolicyRuleV1Beta2.go @@ -0,0 +1,27 @@ +package k8s + + +// ResourcePolicyRule is a predicate that matches some resource requests, testing the request's verb and the target resource. +// +// A ResourcePolicyRule matches a resource request if and only if: (a) at least one member of verbs matches the request, (b) at least one member of apiGroups matches the request, (c) at least one member of resources matches the request, and (d) either (d1) the request does not specify a namespace (i.e., `Namespace==""`) and clusterScope is true or (d2) the request specifies a namespace and least one member of namespaces matches the request's namespace. +type ResourcePolicyRuleV1Beta2 struct { + // `apiGroups` is a list of matching API groups and may not be empty. + // + // "*" matches all API groups and, if present, must be the only entry. Required. + ApiGroups *[]*string `field:"required" json:"apiGroups" yaml:"apiGroups"` + // `resources` is a list of matching resources (i.e., lowercase and plural) with, if desired, subresource. For example, [ "services", "nodes/status" ]. This list may not be empty. "*" matches all resources and, if present, must be the only entry. Required. + Resources *[]*string `field:"required" json:"resources" yaml:"resources"` + // `verbs` is a list of matching verbs and may not be empty. + // + // "*" matches all verbs and, if present, must be the only entry. Required. + Verbs *[]*string `field:"required" json:"verbs" yaml:"verbs"` + // `clusterScope` indicates whether to match requests that do not specify a namespace (which happens either because the resource is not namespaced or the request targets all namespaces). + // + // If this field is omitted or false then the `namespaces` field must contain a non-empty list. + ClusterScope *bool `field:"optional" json:"clusterScope" yaml:"clusterScope"` + // `namespaces` is a list of target namespaces that restricts matches. + // + // A request that specifies a target namespace matches only if either (a) this list contains that target namespace or (b) this list contains "*". Note that "*" matches any specified namespace but does not match a request that _does not specify_ a namespace (see the `clusterScope` field for that). This list may be empty, but only if `clusterScope` is true. + Namespaces *[]*string `field:"optional" json:"namespaces" yaml:"namespaces"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ResourceQuotaSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/ResourceQuotaSpec.go new file mode 100644 index 0000000..1a4243e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ResourceQuotaSpec.go @@ -0,0 +1,19 @@ +package k8s + + +// ResourceQuotaSpec defines the desired hard limits to enforce for Quota. +type ResourceQuotaSpec struct { + // hard is the set of desired hard limits for each named resource. + // + // More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/ + Hard *map[string]Quantity `field:"optional" json:"hard" yaml:"hard"` + // A collection of filters that must match each object tracked by a quota. + // + // If not specified, the quota matches all objects. + Scopes *[]*string `field:"optional" json:"scopes" yaml:"scopes"` + // scopeSelector is also a collection of filters like scopes that must match each object tracked by a quota but expressed using ScopeSelectorOperator in combination with possible values. + // + // For a resource to match, both scopes AND scopeSelector (if specified in spec), must be matched. + ScopeSelector *ScopeSelector `field:"optional" json:"scopeSelector" yaml:"scopeSelector"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ResourceRequirements.go b/examples/cdk8s-sample-deployment/imports/k8s/ResourceRequirements.go new file mode 100644 index 0000000..43febb0 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ResourceRequirements.go @@ -0,0 +1,15 @@ +package k8s + + +// ResourceRequirements describes the compute resource requirements. +type ResourceRequirements struct { + // Limits describes the maximum amount of compute resources allowed. + // + // More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + Limits *map[string]Quantity `field:"optional" json:"limits" yaml:"limits"` + // Requests describes the minimum amount of compute resources required. + // + // If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + Requests *map[string]Quantity `field:"optional" json:"requests" yaml:"requests"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/RoleRef.go b/examples/cdk8s-sample-deployment/imports/k8s/RoleRef.go new file mode 100644 index 0000000..364ad5f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/RoleRef.go @@ -0,0 +1,13 @@ +package k8s + + +// RoleRef contains information that points to the role being used. +type RoleRef struct { + // APIGroup is the group for the resource being referenced. + ApiGroup *string `field:"required" json:"apiGroup" yaml:"apiGroup"` + // Kind is the type of resource being referenced. + Kind *string `field:"required" json:"kind" yaml:"kind"` + // Name is the name of resource being referenced. + Name *string `field:"required" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/RollingUpdateDaemonSet.go b/examples/cdk8s-sample-deployment/imports/k8s/RollingUpdateDaemonSet.go new file mode 100644 index 0000000..33be5c4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/RollingUpdateDaemonSet.go @@ -0,0 +1,15 @@ +package k8s + + +// Spec to control the desired behavior of daemon set rolling update. +type RollingUpdateDaemonSet struct { + // The maximum number of nodes with an existing available DaemonSet pod that can have an updated DaemonSet pod during during an update. + // + // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up to a minimum of 1. Default value is 0. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their a new pod created before the old pod is marked as deleted. The update starts by launching new pods on 30% of nodes. Once an updated pod is available (Ready for at least minReadySeconds) the old DaemonSet pod on that node is marked deleted. If the old pod becomes unavailable for any reason (Ready transitions to false, is evicted, or is drained) an updated pod is immediatedly created on that node without considering surge limits. Allowing surge implies the possibility that the resources consumed by the daemonset on any given node can double if the readiness check fails, and so resource intensive daemonsets should take into account that they may cause evictions during disruption. + MaxSurge IntOrString `field:"optional" json:"maxSurge" yaml:"maxSurge"` + // The maximum number of DaemonSet pods that can be unavailable during the update. + // + // Value can be an absolute number (ex: 5) or a percentage of total number of DaemonSet pods at the start of the update (ex: 10%). Absolute number is calculated from percentage by rounding up. This cannot be 0 if MaxSurge is 0 Default value is 1. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their pods stopped for an update at any given time. The update starts by stopping at most 30% of those DaemonSet pods and then brings up new DaemonSet pods in their place. Once the new pods are available, it then proceeds onto other DaemonSet pods, thus ensuring that at least 70% of original number of DaemonSet pods are available at all times during the update. + MaxUnavailable IntOrString `field:"optional" json:"maxUnavailable" yaml:"maxUnavailable"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/RollingUpdateDeployment.go b/examples/cdk8s-sample-deployment/imports/k8s/RollingUpdateDeployment.go new file mode 100644 index 0000000..7980c65 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/RollingUpdateDeployment.go @@ -0,0 +1,19 @@ +package k8s + + +// Spec to control the desired behavior of rolling update. +type RollingUpdateDeployment struct { + // The maximum number of pods that can be scheduled above the desired number of pods. + // + // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods. + // Default: 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods. + // + MaxSurge IntOrString `field:"optional" json:"maxSurge" yaml:"maxSurge"` + // The maximum number of pods that can be unavailable during the update. + // + // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 25%. Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods. + // Default: 25%. Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods. + // + MaxUnavailable IntOrString `field:"optional" json:"maxUnavailable" yaml:"maxUnavailable"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/RollingUpdateStatefulSetStrategy.go b/examples/cdk8s-sample-deployment/imports/k8s/RollingUpdateStatefulSetStrategy.go new file mode 100644 index 0000000..7ad8d55 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/RollingUpdateStatefulSetStrategy.go @@ -0,0 +1,17 @@ +package k8s + + +// RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType. +type RollingUpdateStatefulSetStrategy struct { + // The maximum number of pods that can be unavailable during the update. + // + // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding up. This can not be 0. Defaults to 1. This field is alpha-level and is only honored by servers that enable the MaxUnavailableStatefulSet feature. The field applies to all pods in the range 0 to Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it will be counted towards MaxUnavailable. + // Default: 1. This field is alpha-level and is only honored by servers that enable the MaxUnavailableStatefulSet feature. The field applies to all pods in the range 0 to Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it will be counted towards MaxUnavailable. + // + MaxUnavailable IntOrString `field:"optional" json:"maxUnavailable" yaml:"maxUnavailable"` + // Partition indicates the ordinal at which the StatefulSet should be partitioned for updates. + // + // During a rolling update, all pods from ordinal Replicas-1 to Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. This is helpful in being able to do a canary based deployment. The default value is 0. + Partition *float64 `field:"optional" json:"partition" yaml:"partition"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/RuleWithOperations.go b/examples/cdk8s-sample-deployment/imports/k8s/RuleWithOperations.go new file mode 100644 index 0000000..125722d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/RuleWithOperations.go @@ -0,0 +1,35 @@ +package k8s + + +// RuleWithOperations is a tuple of Operations and Resources. +// +// It is recommended to make sure that all the tuple expansions are valid. +type RuleWithOperations struct { + // APIGroups is the API groups the resources belong to. + // + // '*' is all groups. If '*' is present, the length of the slice must be one. Required. + ApiGroups *[]*string `field:"optional" json:"apiGroups" yaml:"apiGroups"` + // APIVersions is the API versions the resources belong to. + // + // '*' is all versions. If '*' is present, the length of the slice must be one. Required. + ApiVersions *[]*string `field:"optional" json:"apiVersions" yaml:"apiVersions"` + // Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. + // + // If '*' is present, the length of the slice must be one. Required. + Operations *[]*string `field:"optional" json:"operations" yaml:"operations"` + // Resources is a list of resources this rule applies to. + // + // For example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '_/scale' means all scale subresources. '_/*' means all resources and their subresources. + // + // If wildcard is present, the validation rule will ensure resources do not overlap with each other. + // + // Depending on the enclosing object, subresources might not be allowed. Required. + Resources *[]*string `field:"optional" json:"resources" yaml:"resources"` + // scope specifies the scope of this rule. + // + // Valid values are "Cluster", "Namespaced", and "*" "Cluster" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. "Namespaced" means that only namespaced resources will match this rule. "*" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is "*". + // Default: . + // + Scope *string `field:"optional" json:"scope" yaml:"scope"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ScaleIoPersistentVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/ScaleIoPersistentVolumeSource.go new file mode 100644 index 0000000..9222b02 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ScaleIoPersistentVolumeSource.go @@ -0,0 +1,39 @@ +package k8s + + +// ScaleIOPersistentVolumeSource represents a persistent ScaleIO volume. +type ScaleIoPersistentVolumeSource struct { + // gateway is the host address of the ScaleIO API Gateway. + Gateway *string `field:"required" json:"gateway" yaml:"gateway"` + // secretRef references to the secret for ScaleIO user and other sensitive information. + // + // If this is not provided, Login operation will fail. + SecretRef *SecretReference `field:"required" json:"secretRef" yaml:"secretRef"` + // system is the name of the storage system as configured in ScaleIO. + System *string `field:"required" json:"system" yaml:"system"` + // fsType is the filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Default is "xfs" + // Default: xfs". + // + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // protectionDomain is the name of the ScaleIO Protection Domain for the configured storage. + ProtectionDomain *string `field:"optional" json:"protectionDomain" yaml:"protectionDomain"` + // readOnly defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // sslEnabled is the flag to enable/disable SSL communication with Gateway, default false. + SslEnabled *bool `field:"optional" json:"sslEnabled" yaml:"sslEnabled"` + // storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. + // + // Default is ThinProvisioned. + // Default: ThinProvisioned. + // + StorageMode *string `field:"optional" json:"storageMode" yaml:"storageMode"` + // storagePool is the ScaleIO Storage Pool associated with the protection domain. + StoragePool *string `field:"optional" json:"storagePool" yaml:"storagePool"` + // volumeName is the name of a volume already created in the ScaleIO system that is associated with this volume source. + VolumeName *string `field:"optional" json:"volumeName" yaml:"volumeName"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ScaleIoVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/ScaleIoVolumeSource.go new file mode 100644 index 0000000..12296a8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ScaleIoVolumeSource.go @@ -0,0 +1,41 @@ +package k8s + + +// ScaleIOVolumeSource represents a persistent ScaleIO volume. +type ScaleIoVolumeSource struct { + // gateway is the host address of the ScaleIO API Gateway. + Gateway *string `field:"required" json:"gateway" yaml:"gateway"` + // secretRef references to the secret for ScaleIO user and other sensitive information. + // + // If this is not provided, Login operation will fail. + SecretRef *LocalObjectReference `field:"required" json:"secretRef" yaml:"secretRef"` + // system is the name of the storage system as configured in ScaleIO. + System *string `field:"required" json:"system" yaml:"system"` + // fsType is the filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Default is "xfs". + // Default: xfs". + // + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // protectionDomain is the name of the ScaleIO Protection Domain for the configured storage. + ProtectionDomain *string `field:"optional" json:"protectionDomain" yaml:"protectionDomain"` + // readOnly Defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + // Default: false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // sslEnabled Flag enable/disable SSL communication with Gateway, default false. + SslEnabled *bool `field:"optional" json:"sslEnabled" yaml:"sslEnabled"` + // storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. + // + // Default is ThinProvisioned. + // Default: ThinProvisioned. + // + StorageMode *string `field:"optional" json:"storageMode" yaml:"storageMode"` + // storagePool is the ScaleIO Storage Pool associated with the protection domain. + StoragePool *string `field:"optional" json:"storagePool" yaml:"storagePool"` + // volumeName is the name of a volume already created in the ScaleIO system that is associated with this volume source. + VolumeName *string `field:"optional" json:"volumeName" yaml:"volumeName"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ScaleSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/ScaleSpec.go new file mode 100644 index 0000000..0fa84f5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ScaleSpec.go @@ -0,0 +1,9 @@ +package k8s + + +// ScaleSpec describes the attributes of a scale subresource. +type ScaleSpec struct { + // desired number of instances for the scaled object. + Replicas *float64 `field:"optional" json:"replicas" yaml:"replicas"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Scheduling.go b/examples/cdk8s-sample-deployment/imports/k8s/Scheduling.go new file mode 100644 index 0000000..389ac7b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Scheduling.go @@ -0,0 +1,13 @@ +package k8s + + +// Scheduling specifies the scheduling constraints for nodes supporting a RuntimeClass. +type Scheduling struct { + // nodeSelector lists labels that must be present on nodes that support this RuntimeClass. + // + // Pods using this RuntimeClass can only be scheduled to a node matched by this selector. The RuntimeClass nodeSelector is merged with a pod's existing nodeSelector. Any conflicts will cause the pod to be rejected in admission. + NodeSelector *map[string]*string `field:"optional" json:"nodeSelector" yaml:"nodeSelector"` + // tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. + Tolerations *[]*Toleration `field:"optional" json:"tolerations" yaml:"tolerations"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ScopeSelector.go b/examples/cdk8s-sample-deployment/imports/k8s/ScopeSelector.go new file mode 100644 index 0000000..74d04fe --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ScopeSelector.go @@ -0,0 +1,9 @@ +package k8s + + +// A scope selector represents the AND of the selectors represented by the scoped-resource selector requirements. +type ScopeSelector struct { + // A list of scope selector requirements by scope of the resources. + MatchExpressions *[]*ScopedResourceSelectorRequirement `field:"optional" json:"matchExpressions" yaml:"matchExpressions"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ScopedResourceSelectorRequirement.go b/examples/cdk8s-sample-deployment/imports/k8s/ScopedResourceSelectorRequirement.go new file mode 100644 index 0000000..0b04089 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ScopedResourceSelectorRequirement.go @@ -0,0 +1,17 @@ +package k8s + + +// A scoped-resource selector requirement is a selector that contains values, a scope name, and an operator that relates the scope name and values. +type ScopedResourceSelectorRequirement struct { + // Represents a scope's relationship to a set of values. + // + // Valid operators are In, NotIn, Exists, DoesNotExist. + Operator *string `field:"required" json:"operator" yaml:"operator"` + // The name of the scope that the selector applies to. + ScopeName *string `field:"required" json:"scopeName" yaml:"scopeName"` + // An array of string values. + // + // If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + Values *[]*string `field:"optional" json:"values" yaml:"values"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SeLinuxOptions.go b/examples/cdk8s-sample-deployment/imports/k8s/SeLinuxOptions.go new file mode 100644 index 0000000..48e9c8e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SeLinuxOptions.go @@ -0,0 +1,15 @@ +package k8s + + +// SELinuxOptions are the labels to be applied to the container. +type SeLinuxOptions struct { + // Level is SELinux level label that applies to the container. + Level *string `field:"optional" json:"level" yaml:"level"` + // Role is a SELinux role label that applies to the container. + Role *string `field:"optional" json:"role" yaml:"role"` + // Type is a SELinux type label that applies to the container. + Type *string `field:"optional" json:"type" yaml:"type"` + // User is a SELinux user label that applies to the container. + User *string `field:"optional" json:"user" yaml:"user"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SeccompProfile.go b/examples/cdk8s-sample-deployment/imports/k8s/SeccompProfile.go new file mode 100644 index 0000000..b844d27 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SeccompProfile.go @@ -0,0 +1,17 @@ +package k8s + + +// SeccompProfile defines a pod/container's seccomp profile settings. +// +// Only one profile source may be set. +type SeccompProfile struct { + // type indicates which kind of seccomp profile will be applied. Valid options are:. + // + // Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied. + Type *string `field:"required" json:"type" yaml:"type"` + // localhostProfile indicates a profile defined in a file on the node should be used. + // + // The profile must be preconfigured on the node to work. Must be a descending path, relative to the kubelet's configured seccomp profile location. Must only be set if type is "Localhost". + LocalhostProfile *string `field:"optional" json:"localhostProfile" yaml:"localhostProfile"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SecretEnvSource.go b/examples/cdk8s-sample-deployment/imports/k8s/SecretEnvSource.go new file mode 100644 index 0000000..c437d97 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SecretEnvSource.go @@ -0,0 +1,15 @@ +package k8s + + +// SecretEnvSource selects a Secret to populate the environment variables with. +// +// The contents of the target Secret's Data field will represent the key-value pairs as environment variables. +type SecretEnvSource struct { + // Name of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `field:"optional" json:"name" yaml:"name"` + // Specify whether the Secret must be defined. + Optional *bool `field:"optional" json:"optional" yaml:"optional"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SecretKeySelector.go b/examples/cdk8s-sample-deployment/imports/k8s/SecretKeySelector.go new file mode 100644 index 0000000..491a8e3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SecretKeySelector.go @@ -0,0 +1,17 @@ +package k8s + + +// SecretKeySelector selects a key of a Secret. +type SecretKeySelector struct { + // The key of the secret to select from. + // + // Must be a valid secret key. + Key *string `field:"required" json:"key" yaml:"key"` + // Name of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `field:"optional" json:"name" yaml:"name"` + // Specify whether the Secret or its key must be defined. + Optional *bool `field:"optional" json:"optional" yaml:"optional"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SecretProjection.go b/examples/cdk8s-sample-deployment/imports/k8s/SecretProjection.go new file mode 100644 index 0000000..91114cd --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SecretProjection.go @@ -0,0 +1,19 @@ +package k8s + + +// Adapts a secret into a projected volume. +// +// The contents of the target Secret's Data field will be presented in a projected volume as files using the keys in the Data field as the file names. Note that this is identical to a secret volume source without the default mode. +type SecretProjection struct { + // items if unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. + // + // If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + Items *[]*KeyToPath `field:"optional" json:"items" yaml:"items"` + // Name of the referent. + // + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `field:"optional" json:"name" yaml:"name"` + // optional field specify whether the Secret or its key must be defined. + Optional *bool `field:"optional" json:"optional" yaml:"optional"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SecretReference.go b/examples/cdk8s-sample-deployment/imports/k8s/SecretReference.go new file mode 100644 index 0000000..0ad6261 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SecretReference.go @@ -0,0 +1,13 @@ +package k8s + + +// SecretReference represents a Secret Reference. +// +// It has enough information to retrieve secret in any namespace. +type SecretReference struct { + // name is unique within a namespace to reference a secret resource. + Name *string `field:"optional" json:"name" yaml:"name"` + // namespace defines the space within which the secret name must be unique. + Namespace *string `field:"optional" json:"namespace" yaml:"namespace"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SecretVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/SecretVolumeSource.go new file mode 100644 index 0000000..61dfb46 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SecretVolumeSource.go @@ -0,0 +1,25 @@ +package k8s + + +// Adapts a Secret into a volume. +// +// The contents of the target Secret's Data field will be presented in a volume as files using the keys in the Data field as the file names. Secret volumes support ownership management and SELinux relabeling. +type SecretVolumeSource struct { + // defaultMode is Optional: mode bits used to set permissions on created files by default. + // + // Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + // Default: 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + // + DefaultMode *float64 `field:"optional" json:"defaultMode" yaml:"defaultMode"` + // items If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. + // + // If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + Items *[]*KeyToPath `field:"optional" json:"items" yaml:"items"` + // optional field specify whether the Secret or its keys must be defined. + Optional *bool `field:"optional" json:"optional" yaml:"optional"` + // secretName is the name of the secret in the pod's namespace to use. + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + SecretName *string `field:"optional" json:"secretName" yaml:"secretName"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SecurityContext.go b/examples/cdk8s-sample-deployment/imports/k8s/SecurityContext.go new file mode 100644 index 0000000..acbe9a8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SecurityContext.go @@ -0,0 +1,61 @@ +package k8s + + +// SecurityContext holds security configuration that will be applied to a container. +// +// Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence. +type SecurityContext struct { + // AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. + // + // This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN Note that this field cannot be set when spec.os.name is windows. + AllowPrivilegeEscalation *bool `field:"optional" json:"allowPrivilegeEscalation" yaml:"allowPrivilegeEscalation"` + // The capabilities to add/drop when running containers. + // + // Defaults to the default set of capabilities granted by the container runtime. Note that this field cannot be set when spec.os.name is windows. + // Default: the default set of capabilities granted by the container runtime. Note that this field cannot be set when spec.os.name is windows. + // + Capabilities *Capabilities `field:"optional" json:"capabilities" yaml:"capabilities"` + // Run container in privileged mode. + // + // Processes in privileged containers are essentially equivalent to root on the host. Defaults to false. Note that this field cannot be set when spec.os.name is windows. + // Default: false. Note that this field cannot be set when spec.os.name is windows. + // + Privileged *bool `field:"optional" json:"privileged" yaml:"privileged"` + // procMount denotes the type of proc mount to use for the containers. + // + // The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows. + ProcMount *string `field:"optional" json:"procMount" yaml:"procMount"` + // Whether this container has a read-only root filesystem. + // + // Default is false. Note that this field cannot be set when spec.os.name is windows. + // Default: false. Note that this field cannot be set when spec.os.name is windows. + // + ReadOnlyRootFilesystem *bool `field:"optional" json:"readOnlyRootFilesystem" yaml:"readOnlyRootFilesystem"` + // The GID to run the entrypoint of the container process. + // + // Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows. + RunAsGroup *float64 `field:"optional" json:"runAsGroup" yaml:"runAsGroup"` + // Indicates that the container must run as a non-root user. + // + // If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + RunAsNonRoot *bool `field:"optional" json:"runAsNonRoot" yaml:"runAsNonRoot"` + // The UID to run the entrypoint of the container process. + // + // Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows. + // Default: user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows. + // + RunAsUser *float64 `field:"optional" json:"runAsUser" yaml:"runAsUser"` + // The seccomp options to use by this container. + // + // If seccomp options are provided at both the pod & container level, the container options override the pod options. Note that this field cannot be set when spec.os.name is windows. + SeccompProfile *SeccompProfile `field:"optional" json:"seccompProfile" yaml:"seccompProfile"` + // The SELinux context to be applied to the container. + // + // If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows. + SeLinuxOptions *SeLinuxOptions `field:"optional" json:"seLinuxOptions" yaml:"seLinuxOptions"` + // The Windows specific settings applied to all containers. + // + // If unspecified, the options from the PodSecurityContext will be used. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is linux. + WindowsOptions *WindowsSecurityContextOptions `field:"optional" json:"windowsOptions" yaml:"windowsOptions"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SelfSubjectAccessReviewSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/SelfSubjectAccessReviewSpec.go new file mode 100644 index 0000000..d66e417 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SelfSubjectAccessReviewSpec.go @@ -0,0 +1,13 @@ +package k8s + + +// SelfSubjectAccessReviewSpec is a description of the access request. +// +// Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set. +type SelfSubjectAccessReviewSpec struct { + // NonResourceAttributes describes information for a non-resource access request. + NonResourceAttributes *NonResourceAttributes `field:"optional" json:"nonResourceAttributes" yaml:"nonResourceAttributes"` + // ResourceAuthorizationAttributes describes information for a resource access request. + ResourceAttributes *ResourceAttributes `field:"optional" json:"resourceAttributes" yaml:"resourceAttributes"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SelfSubjectRulesReviewSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/SelfSubjectRulesReviewSpec.go new file mode 100644 index 0000000..f9221c2 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SelfSubjectRulesReviewSpec.go @@ -0,0 +1,11 @@ +package k8s + + +// SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview. +type SelfSubjectRulesReviewSpec struct { + // Namespace to evaluate rules for. + // + // Required. + Namespace *string `field:"optional" json:"namespace" yaml:"namespace"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ServiceAccountSubjectV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/ServiceAccountSubjectV1Beta1.go new file mode 100644 index 0000000..44fa0f9 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ServiceAccountSubjectV1Beta1.go @@ -0,0 +1,15 @@ +package k8s + + +// ServiceAccountSubject holds detailed information for service-account-kind subject. +type ServiceAccountSubjectV1Beta1 struct { + // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. + // + // Required. + Name *string `field:"required" json:"name" yaml:"name"` + // `namespace` is the namespace of matching ServiceAccount objects. + // + // Required. + Namespace *string `field:"required" json:"namespace" yaml:"namespace"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ServiceAccountSubjectV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/ServiceAccountSubjectV1Beta2.go new file mode 100644 index 0000000..09b1d0f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ServiceAccountSubjectV1Beta2.go @@ -0,0 +1,15 @@ +package k8s + + +// ServiceAccountSubject holds detailed information for service-account-kind subject. +type ServiceAccountSubjectV1Beta2 struct { + // `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. + // + // Required. + Name *string `field:"required" json:"name" yaml:"name"` + // `namespace` is the namespace of matching ServiceAccount objects. + // + // Required. + Namespace *string `field:"required" json:"namespace" yaml:"namespace"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ServiceAccountTokenProjection.go b/examples/cdk8s-sample-deployment/imports/k8s/ServiceAccountTokenProjection.go new file mode 100644 index 0000000..b7eea34 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ServiceAccountTokenProjection.go @@ -0,0 +1,21 @@ +package k8s + + +// ServiceAccountTokenProjection represents a projected service account token volume. +// +// This projection can be used to insert a service account token into the pods runtime filesystem for use against APIs (Kubernetes API Server or otherwise). +type ServiceAccountTokenProjection struct { + // path is the path relative to the mount point of the file to project the token into. + Path *string `field:"required" json:"path" yaml:"path"` + // audience is the intended audience of the token. + // + // A recipient of a token must identify itself with an identifier specified in the audience of the token, and otherwise should reject the token. The audience defaults to the identifier of the apiserver. + Audience *string `field:"optional" json:"audience" yaml:"audience"` + // expirationSeconds is the requested duration of validity of the service account token. + // + // As the token approaches expiration, the kubelet volume plugin will proactively rotate the service account token. The kubelet will start trying to rotate the token if the token is older than 80 percent of its time to live or if the token is older than 24 hours.Defaults to 1 hour and must be at least 10 minutes. + // Default: 1 hour and must be at least 10 minutes. + // + ExpirationSeconds *float64 `field:"optional" json:"expirationSeconds" yaml:"expirationSeconds"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ServiceBackendPort.go b/examples/cdk8s-sample-deployment/imports/k8s/ServiceBackendPort.go new file mode 100644 index 0000000..fc5b54a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ServiceBackendPort.go @@ -0,0 +1,13 @@ +package k8s + + +// ServiceBackendPort is the service port being referenced. +type ServiceBackendPort struct { + // Name is the name of the port on the Service. + // + // This is a mutually exclusive setting with "Number". + Name *string `field:"optional" json:"name" yaml:"name"` + // Number is the numerical port number (e.g. 80) on the Service. This is a mutually exclusive setting with "Name". + Number *float64 `field:"optional" json:"number" yaml:"number"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ServicePort.go b/examples/cdk8s-sample-deployment/imports/k8s/ServicePort.go new file mode 100644 index 0000000..1f43eb5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ServicePort.go @@ -0,0 +1,31 @@ +package k8s + + +// ServicePort contains information on service's port. +type ServicePort struct { + // The port that will be exposed by this service. + Port *float64 `field:"required" json:"port" yaml:"port"` + // The application protocol for this port. + // + // This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names such as mycompany.com/my-custom-protocol. + AppProtocol *string `field:"optional" json:"appProtocol" yaml:"appProtocol"` + // The name of this port within the service. + // + // This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. When considering the endpoints for a Service, this must match the 'name' field in the EndpointPort. Optional if only one ServicePort is defined on this service. + Name *string `field:"optional" json:"name" yaml:"name"` + // The port on each node on which this service is exposed when type is NodePort or LoadBalancer. + // + // Usually assigned by the system. If a value is specified, in-range, and not in use it will be used, otherwise the operation will fail. If not specified, a port will be allocated if this Service requires one. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type from NodePort to ClusterIP). More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + NodePort *float64 `field:"optional" json:"nodePort" yaml:"nodePort"` + // The IP protocol for this port. + // + // Supports "TCP", "UDP", and "SCTP". Default is TCP. + // Default: TCP. + // + Protocol *string `field:"optional" json:"protocol" yaml:"protocol"` + // Number or name of the port to access on the pods targeted by the service. + // + // Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service + TargetPort IntOrString `field:"optional" json:"targetPort" yaml:"targetPort"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ServiceReference.go b/examples/cdk8s-sample-deployment/imports/k8s/ServiceReference.go new file mode 100644 index 0000000..fa72c8a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ServiceReference.go @@ -0,0 +1,23 @@ +package k8s + + +// ServiceReference holds a reference to Service.legacy.k8s.io. +type ServiceReference struct { + // `name` is the name of the service. + // + // Required. + Name *string `field:"required" json:"name" yaml:"name"` + // `namespace` is the namespace of the service. + // + // Required. + Namespace *string `field:"required" json:"namespace" yaml:"namespace"` + // `path` is an optional URL path which will be sent in any request to this service. + Path *string `field:"optional" json:"path" yaml:"path"` + // If specified, the port on the service that hosting webhook. + // + // Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive). + // Default: 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive). + // + Port *float64 `field:"optional" json:"port" yaml:"port"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ServiceSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/ServiceSpec.go new file mode 100644 index 0000000..d08a37d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ServiceSpec.go @@ -0,0 +1,87 @@ +package k8s + + +// ServiceSpec describes the attributes that a user creates on a service. +type ServiceSpec struct { + // allocateLoadBalancerNodePorts defines if NodePorts will be automatically allocated for services with type LoadBalancer. + // + // Default is "true". It may be set to "false" if the cluster load-balancer does not rely on NodePorts. If the caller requests specific NodePorts (by specifying a value), those requests will be respected, regardless of this field. This field may only be set for services with type LoadBalancer and will be cleared if the type is changed to any other type. + // Default: true". It may be set to "false" if the cluster load-balancer does not rely on NodePorts. If the caller requests specific NodePorts (by specifying a value), those requests will be respected, regardless of this field. This field may only be set for services with type LoadBalancer and will be cleared if the type is changed to any other type. + // + AllocateLoadBalancerNodePorts *bool `field:"optional" json:"allocateLoadBalancerNodePorts" yaml:"allocateLoadBalancerNodePorts"` + // clusterIP is the IP address of the service and is usually assigned randomly. + // + // If an address is specified manually, is in-range (as per system configuration), and is not in use, it will be allocated to the service; otherwise creation of the service will fail. This field may not be changed through updates unless the type field is also being changed to ExternalName (which requires this field to be blank) or the type field is being changed from ExternalName (in which case this field may optionally be specified, as describe above). Valid values are "None", empty string (""), or a valid IP address. Setting this to "None" makes a "headless service" (no virtual IP), which is useful when direct endpoint connections are preferred and proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. If this field is specified when creating a Service of type ExternalName, creation will fail. This field will be wiped when updating a Service to type ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + ClusterIp *string `field:"optional" json:"clusterIp" yaml:"clusterIp"` + // ClusterIPs is a list of IP addresses assigned to this service, and are usually assigned randomly. + // + // If an address is specified manually, is in-range (as per system configuration), and is not in use, it will be allocated to the service; otherwise creation of the service will fail. This field may not be changed through updates unless the type field is also being changed to ExternalName (which requires this field to be empty) or the type field is being changed from ExternalName (in which case this field may optionally be specified, as describe above). Valid values are "None", empty string (""), or a valid IP address. Setting this to "None" makes a "headless service" (no virtual IP), which is useful when direct endpoint connections are preferred and proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. If this field is specified when creating a Service of type ExternalName, creation will fail. This field will be wiped when updating a Service to type ExternalName. If this field is not specified, it will be initialized from the clusterIP field. If this field is specified, clients must ensure that clusterIPs[0] and clusterIP have the same value. + // + // This field may hold a maximum of two entries (dual-stack IPs, in either order). These IPs must correspond to the values of the ipFamilies field. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + ClusterIPs *[]*string `field:"optional" json:"clusterIPs" yaml:"clusterIPs"` + // externalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service. + // + // These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system. + ExternalIPs *[]*string `field:"optional" json:"externalIPs" yaml:"externalIPs"` + // externalName is the external reference that discovery mechanisms will return as an alias for this service (e.g. a DNS CNAME record). No proxying will be involved. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) and requires `type` to be "ExternalName". + ExternalName *string `field:"optional" json:"externalName" yaml:"externalName"` + // externalTrafficPolicy describes how nodes distribute service traffic they receive on one of the Service's "externally-facing" addresses (NodePorts, ExternalIPs, and LoadBalancer IPs). + // + // If set to "Local", the proxy will configure the service in a way that assumes that external load balancers will take care of balancing the service traffic between nodes, and so each node will deliver traffic only to the node-local endpoints of the service, without masquerading the client source IP. (Traffic mistakenly sent to a node with no endpoints will be dropped.) The default value, "Cluster", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features). Note that traffic sent to an External IP or LoadBalancer IP from within the cluster will always get "Cluster" semantics, but clients sending to a NodePort from within the cluster may need to take traffic policy into account when picking a node. + ExternalTrafficPolicy *string `field:"optional" json:"externalTrafficPolicy" yaml:"externalTrafficPolicy"` + // healthCheckNodePort specifies the healthcheck nodePort for the service. + // + // This only applies when type is set to LoadBalancer and externalTrafficPolicy is set to Local. If a value is specified, is in-range, and is not in use, it will be used. If not specified, a value will be automatically allocated. External systems (e.g. load-balancers) can use this port to determine if a given node holds endpoints for this service or not. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type). This field cannot be updated once set. + HealthCheckNodePort *float64 `field:"optional" json:"healthCheckNodePort" yaml:"healthCheckNodePort"` + // InternalTrafficPolicy describes how nodes distribute service traffic they receive on the ClusterIP. + // + // If set to "Local", the proxy will assume that pods only want to talk to endpoints of the service on the same node as the pod, dropping the traffic if there are no local endpoints. The default value, "Cluster", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features). + InternalTrafficPolicy *string `field:"optional" json:"internalTrafficPolicy" yaml:"internalTrafficPolicy"` + // IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this service. This field is usually assigned automatically based on cluster configuration and the ipFamilyPolicy field. If this field is specified manually, the requested family is available in the cluster, and ipFamilyPolicy allows it, it will be used; otherwise creation of the service will fail. This field is conditionally mutable: it allows for adding or removing a secondary IP family, but it does not allow changing the primary IP family of the Service. Valid values are "IPv4" and "IPv6". This field only applies to Services of types ClusterIP, NodePort, and LoadBalancer, and does apply to "headless" services. This field will be wiped when updating a Service to type ExternalName. + // + // This field may hold a maximum of two entries (dual-stack families, in either order). These families must correspond to the values of the clusterIPs field, if specified. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. + IpFamilies *[]*string `field:"optional" json:"ipFamilies" yaml:"ipFamilies"` + // IPFamilyPolicy represents the dual-stack-ness requested or required by this Service. + // + // If there is no value provided, then this field will be set to SingleStack. Services can be "SingleStack" (a single IP family), "PreferDualStack" (two IP families on dual-stack configured clusters or a single IP family on single-stack clusters), or "RequireDualStack" (two IP families on dual-stack configured clusters, otherwise fail). The ipFamilies and clusterIPs fields depend on the value of this field. This field will be wiped when updating a service to type ExternalName. + IpFamilyPolicy *string `field:"optional" json:"ipFamilyPolicy" yaml:"ipFamilyPolicy"` + // loadBalancerClass is the class of the load balancer implementation this Service belongs to. + // + // If specified, the value of this field must be a label-style identifier, with an optional prefix, e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users. This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load balancer implementation is used, today this is typically done through the cloud provider integration, but should apply for any default implementation. If set, it is assumed that a load balancer implementation is watching for Services with a matching class. Any default load balancer implementation (e.g. cloud providers) should ignore Services that set this field. This field can only be set when creating or updating a Service to type 'LoadBalancer'. Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type. + LoadBalancerClass *string `field:"optional" json:"loadBalancerClass" yaml:"loadBalancerClass"` + // Only applies to Service Type: LoadBalancer. + // + // This feature depends on whether the underlying cloud-provider supports specifying the loadBalancerIP when a load balancer is created. This field will be ignored if the cloud-provider does not support the feature. Deprecated: This field was under-specified and its meaning varies across implementations, and it cannot support dual-stack. As of Kubernetes v1.24, users are encouraged to use implementation-specific annotations when available. This field may be removed in a future API version. + LoadBalancerIp *string `field:"optional" json:"loadBalancerIp" yaml:"loadBalancerIp"` + // If specified and supported by the platform, this will restrict traffic through the cloud-provider load-balancer will be restricted to the specified client IPs. + // + // This field will be ignored if the cloud-provider does not support the feature." More info: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/ + LoadBalancerSourceRanges *[]*string `field:"optional" json:"loadBalancerSourceRanges" yaml:"loadBalancerSourceRanges"` + // The list of ports that are exposed by this service. + // + // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + Ports *[]*ServicePort `field:"optional" json:"ports" yaml:"ports"` + // publishNotReadyAddresses indicates that any agent which deals with endpoints for this Service should disregard any indications of ready/not-ready. + // + // The primary use case for setting this field is for a StatefulSet's Headless Service to propagate SRV DNS records for its Pods for the purpose of peer discovery. The Kubernetes controllers that generate Endpoints and EndpointSlice resources for Services interpret this to mean that all endpoints are considered "ready" even if the Pods themselves are not. Agents which consume only Kubernetes generated endpoints through the Endpoints or EndpointSlice resources can safely assume this behavior. + PublishNotReadyAddresses *bool `field:"optional" json:"publishNotReadyAddresses" yaml:"publishNotReadyAddresses"` + // Route service traffic to pods with label keys and values matching this selector. + // + // If empty or not present, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/ + Selector *map[string]*string `field:"optional" json:"selector" yaml:"selector"` + // Supports "ClientIP" and "None". + // + // Used to maintain session affinity. Enable client IP based session affinity. Must be ClientIP or None. Defaults to None. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + // Default: None. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + // + SessionAffinity *string `field:"optional" json:"sessionAffinity" yaml:"sessionAffinity"` + // sessionAffinityConfig contains the configurations of session affinity. + SessionAffinityConfig *SessionAffinityConfig `field:"optional" json:"sessionAffinityConfig" yaml:"sessionAffinityConfig"` + // type determines how the Service is exposed. + // + // Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer. "ClusterIP" allocates a cluster-internal IP address for load-balancing to endpoints. Endpoints are determined by the selector or if that is not specified, by manual construction of an Endpoints object or EndpointSlice objects. If clusterIP is "None", no virtual IP is allocated and the endpoints are published as a set of endpoints rather than a virtual IP. "NodePort" builds on ClusterIP and allocates a port on every node which routes to the same endpoints as the clusterIP. "LoadBalancer" builds on NodePort and creates an external load-balancer (if supported in the current cloud) which routes to the same endpoints as the clusterIP. "ExternalName" aliases this service to the specified externalName. Several other fields do not apply to ExternalName services. More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + // Default: ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer. "ClusterIP" allocates a cluster-internal IP address for load-balancing to endpoints. Endpoints are determined by the selector or if that is not specified, by manual construction of an Endpoints object or EndpointSlice objects. If clusterIP is "None", no virtual IP is allocated and the endpoints are published as a set of endpoints rather than a virtual IP. "NodePort" builds on ClusterIP and allocates a port on every node which routes to the same endpoints as the clusterIP. "LoadBalancer" builds on NodePort and creates an external load-balancer (if supported in the current cloud) which routes to the same endpoints as the clusterIP. "ExternalName" aliases this service to the specified externalName. Several other fields do not apply to ExternalName services. More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + // + Type *string `field:"optional" json:"type" yaml:"type"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SessionAffinityConfig.go b/examples/cdk8s-sample-deployment/imports/k8s/SessionAffinityConfig.go new file mode 100644 index 0000000..e7e7f64 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SessionAffinityConfig.go @@ -0,0 +1,9 @@ +package k8s + + +// SessionAffinityConfig represents the configurations of session affinity. +type SessionAffinityConfig struct { + // clientIP contains the configurations of Client IP based session affinity. + ClientIp *ClientIpConfig `field:"optional" json:"clientIp" yaml:"clientIp"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/StatefulSetPersistentVolumeClaimRetentionPolicy.go b/examples/cdk8s-sample-deployment/imports/k8s/StatefulSetPersistentVolumeClaimRetentionPolicy.go new file mode 100644 index 0000000..93114c8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/StatefulSetPersistentVolumeClaimRetentionPolicy.go @@ -0,0 +1,15 @@ +package k8s + + +// StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from the StatefulSet VolumeClaimTemplates. +type StatefulSetPersistentVolumeClaimRetentionPolicy struct { + // WhenDeleted specifies what happens to PVCs created from StatefulSet VolumeClaimTemplates when the StatefulSet is deleted. + // + // The default policy of `Retain` causes PVCs to not be affected by StatefulSet deletion. The `Delete` policy causes those PVCs to be deleted. + WhenDeleted *string `field:"optional" json:"whenDeleted" yaml:"whenDeleted"` + // WhenScaled specifies what happens to PVCs created from StatefulSet VolumeClaimTemplates when the StatefulSet is scaled down. + // + // The default policy of `Retain` causes PVCs to not be affected by a scaledown. The `Delete` policy causes the associated PVCs for any excess pods above the replica count to be deleted. + WhenScaled *string `field:"optional" json:"whenScaled" yaml:"whenScaled"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/StatefulSetSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/StatefulSetSpec.go new file mode 100644 index 0000000..c000c49 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/StatefulSetSpec.go @@ -0,0 +1,47 @@ +package k8s + + +// A StatefulSetSpec is the specification of a StatefulSet. +type StatefulSetSpec struct { + // selector is a label query over pods that should match the replica count. + // + // It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector *LabelSelector `field:"required" json:"selector" yaml:"selector"` + // serviceName is the name of the service that governs this StatefulSet. + // + // This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where "pod-specific-string" is managed by the StatefulSet controller. + ServiceName *string `field:"required" json:"serviceName" yaml:"serviceName"` + // template is the object that describes the pod that will be created if insufficient replicas are detected. + // + // Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet. + Template *PodTemplateSpec `field:"required" json:"template" yaml:"template"` + // Minimum number of seconds for which a newly created pod should be ready without any of its container crashing for it to be considered available. + // + // Defaults to 0 (pod will be considered available as soon as it is ready). + // Default: 0 (pod will be considered available as soon as it is ready). + // + MinReadySeconds *float64 `field:"optional" json:"minReadySeconds" yaml:"minReadySeconds"` + // persistentVolumeClaimRetentionPolicy describes the lifecycle of persistent volume claims created from volumeClaimTemplates. + // + // By default, all persistent volume claims are created as needed and retained until manually deleted. This policy allows the lifecycle to be altered, for example by deleting persistent volume claims when their stateful set is deleted, or when their pod is scaled down. This requires the StatefulSetAutoDeletePVC feature gate to be enabled, which is alpha. +optional + PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicy `field:"optional" json:"persistentVolumeClaimRetentionPolicy" yaml:"persistentVolumeClaimRetentionPolicy"` + // podManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. + // + // The default policy is `OrderedReady`, where pods are created in increasing order (pod-0, then pod-1, etc) and the controller will wait until each pod is ready before continuing. When scaling down, the pods are removed in the opposite order. The alternative policy is `Parallel` which will create pods in parallel to match the desired scale without waiting, and on scale down will delete all pods at once. + PodManagementPolicy *string `field:"optional" json:"podManagementPolicy" yaml:"podManagementPolicy"` + // replicas is the desired number of replicas of the given Template. + // + // These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1. + Replicas *float64 `field:"optional" json:"replicas" yaml:"replicas"` + // revisionHistoryLimit is the maximum number of revisions that will be maintained in the StatefulSet's revision history. + // + // The revision history consists of all revisions not represented by a currently applied StatefulSetSpec version. The default value is 10. + RevisionHistoryLimit *float64 `field:"optional" json:"revisionHistoryLimit" yaml:"revisionHistoryLimit"` + // updateStrategy indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template. + UpdateStrategy *StatefulSetUpdateStrategy `field:"optional" json:"updateStrategy" yaml:"updateStrategy"` + // volumeClaimTemplates is a list of claims that pods are allowed to reference. + // + // The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name. + VolumeClaimTemplates *[]*KubePersistentVolumeClaimProps `field:"optional" json:"volumeClaimTemplates" yaml:"volumeClaimTemplates"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/StatefulSetUpdateStrategy.go b/examples/cdk8s-sample-deployment/imports/k8s/StatefulSetUpdateStrategy.go new file mode 100644 index 0000000..1e2f06a --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/StatefulSetUpdateStrategy.go @@ -0,0 +1,17 @@ +package k8s + + +// StatefulSetUpdateStrategy indicates the strategy that the StatefulSet controller will use to perform updates. +// +// It includes any additional parameters necessary to perform the update for the indicated strategy. +type StatefulSetUpdateStrategy struct { + // RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType. + RollingUpdate *RollingUpdateStatefulSetStrategy `field:"optional" json:"rollingUpdate" yaml:"rollingUpdate"` + // Type indicates the type of the StatefulSetUpdateStrategy. + // + // Default is RollingUpdate. + // Default: RollingUpdate. + // + Type *string `field:"optional" json:"type" yaml:"type"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/StatusCause.go b/examples/cdk8s-sample-deployment/imports/k8s/StatusCause.go new file mode 100644 index 0000000..5817903 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/StatusCause.go @@ -0,0 +1,23 @@ +package k8s + + +// StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered. +type StatusCause struct { + // The field of the resource that has caused this error, as named by its JSON serialization. + // + // May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional. + // + // Examples: + // "name" - the field "name" on the current resource + // "items[0].name" - the field "name" on the first array entry in "items" + Field *string `field:"optional" json:"field" yaml:"field"` + // A human-readable description of the cause of the error. + // + // This field may be presented as-is to a reader. + Message *string `field:"optional" json:"message" yaml:"message"` + // A machine-readable description of the cause of the error. + // + // If this value is empty there is no information available. + Reason *string `field:"optional" json:"reason" yaml:"reason"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/StatusDetails.go b/examples/cdk8s-sample-deployment/imports/k8s/StatusDetails.go new file mode 100644 index 0000000..069a4e7 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/StatusDetails.go @@ -0,0 +1,29 @@ +package k8s + + +// StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. +// +// The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined. +type StatusDetails struct { + // The Causes array includes more details associated with the StatusReason failure. + // + // Not all StatusReasons may provide detailed causes. + Causes *[]*StatusCause `field:"optional" json:"causes" yaml:"causes"` + // The group attribute of the resource associated with the status StatusReason. + Group *string `field:"optional" json:"group" yaml:"group"` + // The kind attribute of the resource associated with the status StatusReason. + // + // On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + Kind *string `field:"optional" json:"kind" yaml:"kind"` + // The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described). + Name *string `field:"optional" json:"name" yaml:"name"` + // If specified, the time in seconds before the operation should be retried. + // + // Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action. + RetryAfterSeconds *float64 `field:"optional" json:"retryAfterSeconds" yaml:"retryAfterSeconds"` + // UID of the resource. + // + // (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids + Uid *string `field:"optional" json:"uid" yaml:"uid"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/StorageOsPersistentVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/StorageOsPersistentVolumeSource.go new file mode 100644 index 0000000..5f8f080 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/StorageOsPersistentVolumeSource.go @@ -0,0 +1,27 @@ +package k8s + + +// Represents a StorageOS persistent volume resource. +type StorageOsPersistentVolumeSource struct { + // fsType is the filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // readOnly defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretRef specifies the secret to use for obtaining the StorageOS API credentials. + // + // If not specified, default values will be attempted. + SecretRef *ObjectReference `field:"optional" json:"secretRef" yaml:"secretRef"` + // volumeName is the human-readable name of the StorageOS volume. + // + // Volume names are only unique within a namespace. + VolumeName *string `field:"optional" json:"volumeName" yaml:"volumeName"` + // volumeNamespace specifies the scope of the volume within StorageOS. + // + // If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to "default" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created. + VolumeNamespace *string `field:"optional" json:"volumeNamespace" yaml:"volumeNamespace"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/StorageOsVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/StorageOsVolumeSource.go new file mode 100644 index 0000000..c822001 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/StorageOsVolumeSource.go @@ -0,0 +1,27 @@ +package k8s + + +// Represents a StorageOS persistent volume resource. +type StorageOsVolumeSource struct { + // fsType is the filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // readOnly defaults to false (read/write). + // + // ReadOnly here will force the ReadOnly setting in VolumeMounts. + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // secretRef specifies the secret to use for obtaining the StorageOS API credentials. + // + // If not specified, default values will be attempted. + SecretRef *LocalObjectReference `field:"optional" json:"secretRef" yaml:"secretRef"` + // volumeName is the human-readable name of the StorageOS volume. + // + // Volume names are only unique within a namespace. + VolumeName *string `field:"optional" json:"volumeName" yaml:"volumeName"` + // volumeNamespace specifies the scope of the volume within StorageOS. + // + // If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to "default" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created. + VolumeNamespace *string `field:"optional" json:"volumeNamespace" yaml:"volumeNamespace"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Subject.go b/examples/cdk8s-sample-deployment/imports/k8s/Subject.go new file mode 100644 index 0000000..08e5e92 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Subject.go @@ -0,0 +1,25 @@ +package k8s + + +// Subject contains a reference to the object or user identities a role binding applies to. +// +// This can either hold a direct API object reference, or a value for non-objects such as user and group names. +type Subject struct { + // Kind of object being referenced. + // + // Values defined by this API group are "User", "Group", and "ServiceAccount". If the Authorizer does not recognized the kind value, the Authorizer should report an error. + Kind *string `field:"required" json:"kind" yaml:"kind"` + // Name of the object being referenced. + Name *string `field:"required" json:"name" yaml:"name"` + // APIGroup holds the API group of the referenced subject. + // + // Defaults to "" for ServiceAccount subjects. Defaults to "rbac.authorization.k8s.io" for User and Group subjects. + // Default: for ServiceAccount subjects. Defaults to "rbac.authorization.k8s.io" for User and Group subjects. + // + ApiGroup *string `field:"optional" json:"apiGroup" yaml:"apiGroup"` + // Namespace of the referenced object. + // + // If the object kind is non-namespace, such as "User" or "Group", and this value is not empty the Authorizer should report an error. + Namespace *string `field:"optional" json:"namespace" yaml:"namespace"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SubjectAccessReviewSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/SubjectAccessReviewSpec.go new file mode 100644 index 0000000..e8496ea --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SubjectAccessReviewSpec.go @@ -0,0 +1,23 @@ +package k8s + + +// SubjectAccessReviewSpec is a description of the access request. +// +// Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set. +type SubjectAccessReviewSpec struct { + // Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer it needs a reflection here. + Extra *map[string]*[]*string `field:"optional" json:"extra" yaml:"extra"` + // Groups is the groups you're testing for. + Groups *[]*string `field:"optional" json:"groups" yaml:"groups"` + // NonResourceAttributes describes information for a non-resource access request. + NonResourceAttributes *NonResourceAttributes `field:"optional" json:"nonResourceAttributes" yaml:"nonResourceAttributes"` + // ResourceAuthorizationAttributes describes information for a resource access request. + ResourceAttributes *ResourceAttributes `field:"optional" json:"resourceAttributes" yaml:"resourceAttributes"` + // UID information about the requesting user. + Uid *string `field:"optional" json:"uid" yaml:"uid"` + // User is the user you're testing for. + // + // If you specify "User" but not "Groups", then is it interpreted as "What if User were not a member of any groups. + User *string `field:"optional" json:"user" yaml:"user"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SubjectV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/SubjectV1Beta1.go new file mode 100644 index 0000000..59f39c6 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SubjectV1Beta1.go @@ -0,0 +1,19 @@ +package k8s + + +// Subject matches the originator of a request, as identified by the request authentication system. +// +// There are three ways of matching an originator; by user, group, or service account. +type SubjectV1Beta1 struct { + // `kind` indicates which one of the other fields is non-empty. + // + // Required. + Kind *string `field:"required" json:"kind" yaml:"kind"` + // `group` matches based on user group name. + Group *GroupSubjectV1Beta1 `field:"optional" json:"group" yaml:"group"` + // `serviceAccount` matches ServiceAccounts. + ServiceAccount *ServiceAccountSubjectV1Beta1 `field:"optional" json:"serviceAccount" yaml:"serviceAccount"` + // `user` matches based on username. + User *UserSubjectV1Beta1 `field:"optional" json:"user" yaml:"user"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/SubjectV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/SubjectV1Beta2.go new file mode 100644 index 0000000..8faae2c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/SubjectV1Beta2.go @@ -0,0 +1,19 @@ +package k8s + + +// Subject matches the originator of a request, as identified by the request authentication system. +// +// There are three ways of matching an originator; by user, group, or service account. +type SubjectV1Beta2 struct { + // `kind` indicates which one of the other fields is non-empty. + // + // Required. + Kind *string `field:"required" json:"kind" yaml:"kind"` + // `group` matches based on user group name. + Group *GroupSubjectV1Beta2 `field:"optional" json:"group" yaml:"group"` + // `serviceAccount` matches ServiceAccounts. + ServiceAccount *ServiceAccountSubjectV1Beta2 `field:"optional" json:"serviceAccount" yaml:"serviceAccount"` + // `user` matches based on username. + User *UserSubjectV1Beta2 `field:"optional" json:"user" yaml:"user"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Sysctl.go b/examples/cdk8s-sample-deployment/imports/k8s/Sysctl.go new file mode 100644 index 0000000..57f2c0e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Sysctl.go @@ -0,0 +1,11 @@ +package k8s + + +// Sysctl defines a kernel parameter to be set. +type Sysctl struct { + // Name of a property to set. + Name *string `field:"required" json:"name" yaml:"name"` + // Value of a property to set. + Value *string `field:"required" json:"value" yaml:"value"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Taint.go b/examples/cdk8s-sample-deployment/imports/k8s/Taint.go new file mode 100644 index 0000000..33ee405 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Taint.go @@ -0,0 +1,24 @@ +package k8s + +import ( + "time" +) + +// The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint. +type Taint struct { + // Required. + // + // The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule and NoExecute. + Effect *string `field:"required" json:"effect" yaml:"effect"` + // Required. + // + // The taint key to be applied to a node. + Key *string `field:"required" json:"key" yaml:"key"` + // TimeAdded represents the time at which the taint was added. + // + // It is only written for NoExecute taints. + TimeAdded *time.Time `field:"optional" json:"timeAdded" yaml:"timeAdded"` + // The taint value corresponding to the taint key. + Value *string `field:"optional" json:"value" yaml:"value"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/TcpSocketAction.go b/examples/cdk8s-sample-deployment/imports/k8s/TcpSocketAction.go new file mode 100644 index 0000000..a919b1e --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/TcpSocketAction.go @@ -0,0 +1,13 @@ +package k8s + + +// TCPSocketAction describes an action based on opening a socket. +type TcpSocketAction struct { + // Number or name of the port to access on the container. + // + // Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. + Port IntOrString `field:"required" json:"port" yaml:"port"` + // Optional: Host name to connect to, defaults to the pod IP. + Host *string `field:"optional" json:"host" yaml:"host"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/TokenRequest.go b/examples/cdk8s-sample-deployment/imports/k8s/TokenRequest.go new file mode 100644 index 0000000..c4a1d87 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/TokenRequest.go @@ -0,0 +1,15 @@ +package k8s + + +// TokenRequest contains parameters of a service account token. +type TokenRequest struct { + // Audience is the intended audience of the token in "TokenRequestSpec". + // + // It will default to the audiences of kube apiserver. + Audience *string `field:"required" json:"audience" yaml:"audience"` + // ExpirationSeconds is the duration of validity of the token in "TokenRequestSpec". + // + // It has the same default value of "ExpirationSeconds" in "TokenRequestSpec". + ExpirationSeconds *float64 `field:"optional" json:"expirationSeconds" yaml:"expirationSeconds"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/TokenRequestSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/TokenRequestSpec.go new file mode 100644 index 0000000..adccd66 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/TokenRequestSpec.go @@ -0,0 +1,19 @@ +package k8s + + +// TokenRequestSpec contains client provided parameters of a token request. +type TokenRequestSpec struct { + // Audiences are the intendend audiences of the token. + // + // A recipient of a token must identify themself with an identifier in the list of audiences of the token, and otherwise should reject the token. A token issued for multiple audiences may be used to authenticate against any of the audiences listed but implies a high degree of trust between the target audiences. + Audiences *[]*string `field:"required" json:"audiences" yaml:"audiences"` + // BoundObjectRef is a reference to an object that the token will be bound to. + // + // The token will only be valid for as long as the bound object exists. NOTE: The API server's TokenReview endpoint will validate the BoundObjectRef, but other audiences may not. Keep ExpirationSeconds small if you want prompt revocation. + BoundObjectRef *BoundObjectReference `field:"optional" json:"boundObjectRef" yaml:"boundObjectRef"` + // ExpirationSeconds is the requested duration of validity of the request. + // + // The token issuer may return a token with a different validity duration so a client needs to check the 'expiration' field in a response. + ExpirationSeconds *float64 `field:"optional" json:"expirationSeconds" yaml:"expirationSeconds"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/TokenReviewSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/TokenReviewSpec.go new file mode 100644 index 0000000..ddd1918 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/TokenReviewSpec.go @@ -0,0 +1,13 @@ +package k8s + + +// TokenReviewSpec is a description of the token authentication request. +type TokenReviewSpec struct { + // Audiences is a list of the identifiers that the resource server presented with the token identifies as. + // + // Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver. + Audiences *[]*string `field:"optional" json:"audiences" yaml:"audiences"` + // Token is the opaque bearer token. + Token *string `field:"optional" json:"token" yaml:"token"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Toleration.go b/examples/cdk8s-sample-deployment/imports/k8s/Toleration.go new file mode 100644 index 0000000..51013bb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Toleration.go @@ -0,0 +1,29 @@ +package k8s + + +// The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator . +type Toleration struct { + // Effect indicates the taint effect to match. + // + // Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. + Effect *string `field:"optional" json:"effect" yaml:"effect"` + // Key is the taint key that the toleration applies to. + // + // Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. + Key *string `field:"optional" json:"key" yaml:"key"` + // Operator represents a key's relationship to the value. + // + // Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category. + // Default: Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category. + // + Operator *string `field:"optional" json:"operator" yaml:"operator"` + // TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. + // + // By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system. + TolerationSeconds *float64 `field:"optional" json:"tolerationSeconds" yaml:"tolerationSeconds"` + // Value is the taint value the toleration matches to. + // + // If the operator is Exists, the value should be empty, otherwise just a regular string. + Value *string `field:"optional" json:"value" yaml:"value"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/TopologySelectorLabelRequirement.go b/examples/cdk8s-sample-deployment/imports/k8s/TopologySelectorLabelRequirement.go new file mode 100644 index 0000000..a6bfc61 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/TopologySelectorLabelRequirement.go @@ -0,0 +1,15 @@ +package k8s + + +// A topology selector requirement is a selector that matches given label. +// +// This is an alpha feature and may change in the future. +type TopologySelectorLabelRequirement struct { + // The label key that the selector applies to. + Key *string `field:"required" json:"key" yaml:"key"` + // An array of string values. + // + // One value must match the label to be selected. Each entry in Values is ORed. + Values *[]*string `field:"required" json:"values" yaml:"values"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/TopologySelectorTerm.go b/examples/cdk8s-sample-deployment/imports/k8s/TopologySelectorTerm.go new file mode 100644 index 0000000..91985c4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/TopologySelectorTerm.go @@ -0,0 +1,11 @@ +package k8s + + +// A topology selector term represents the result of label queries. +// +// A null or empty topology selector term matches no objects. The requirements of them are ANDed. It provides a subset of functionality as NodeSelectorTerm. This is an alpha feature and may change in the future. +type TopologySelectorTerm struct { + // A list of topology selector requirements by labels. + MatchLabelExpressions *[]*TopologySelectorLabelRequirement `field:"optional" json:"matchLabelExpressions" yaml:"matchLabelExpressions"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/TopologySpreadConstraint.go b/examples/cdk8s-sample-deployment/imports/k8s/TopologySpreadConstraint.go new file mode 100644 index 0000000..e6ffc7b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/TopologySpreadConstraint.go @@ -0,0 +1,50 @@ +package k8s + + +// TopologySpreadConstraint specifies how to spread matching pods among the given topology. +type TopologySpreadConstraint struct { + // MaxSkew describes the degree to which pods may be unevenly distributed. + // + // When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference between the number of matching pods in the target topology and the global minimum. The global minimum is the minimum number of matching pods in an eligible domain or zero if the number of eligible domains is less than MinDomains. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 2/2/1: In this case, the global minimum is 1. | zone1 | zone2 | zone3 | | P P | P P | P | - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence to topologies that satisfy it. It's a required field. Default value is 1 and 0 is not allowed. + MaxSkew *float64 `field:"required" json:"maxSkew" yaml:"maxSkew"` + // TopologyKey is the key of node labels. + // + // Nodes that have a label with this key and identical values are considered to be in the same topology. We consider each as a "bucket", and try to put balanced number of pods into each bucket. We define a domain as a particular instance of a topology. Also, we define an eligible domain as a domain whose nodes meet the requirements of nodeAffinityPolicy and nodeTaintsPolicy. e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. It's a required field. + TopologyKey *string `field:"required" json:"topologyKey" yaml:"topologyKey"` + // WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy the spread constraint. + // + // - DoNotSchedule (default) tells the scheduler not to schedule it. - ScheduleAnyway tells the scheduler to schedule the pod in any location, + // but giving higher precedence to topologies that would help reduce the + // skew. + // A constraint is considered "Unsatisfiable" for an incoming pod if and only if every possible node assignment for that pod would violate "MaxSkew" on some topology. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P | P | P | If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler won't make it *more* imbalanced. It's a required field. + WhenUnsatisfiable *string `field:"required" json:"whenUnsatisfiable" yaml:"whenUnsatisfiable"` + // LabelSelector is used to find matching pods. + // + // Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain. + LabelSelector *LabelSelector `field:"optional" json:"labelSelector" yaml:"labelSelector"` + // MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. + // + // The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + MatchLabelKeys *[]*string `field:"optional" json:"matchLabelKeys" yaml:"matchLabelKeys"` + // MinDomains indicates a minimum number of eligible domains. + // + // When the number of eligible domains with matching topology keys is less than minDomains, Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. And when the number of eligible domains with matching topology keys equals or greater than minDomains, this value has no effect on scheduling. As a result, when the number of eligible domains is less than minDomains, scheduler won't schedule more than maxSkew Pods to those domains. If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + // + // For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. In this situation, new pod with the same labelSelector cannot be scheduled, because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, it will violate MaxSkew. + // + // This is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default). + MinDomains *float64 `field:"optional" json:"minDomains" yaml:"minDomains"` + // NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector when calculating pod topology spread skew. + // + // Options are: - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + // + // If this value is nil, the behavior is equivalent to the Honor policy. This is a alpha-level feature enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. + NodeAffinityPolicy *string `field:"optional" json:"nodeAffinityPolicy" yaml:"nodeAffinityPolicy"` + // NodeTaintsPolicy indicates how we will treat node taints when calculating pod topology spread skew. + // + // Options are: - Honor: nodes without taints, along with tainted nodes for which the incoming pod has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. + // + // If this value is nil, the behavior is equivalent to the Ignore policy. This is a alpha-level feature enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. + NodeTaintsPolicy *string `field:"optional" json:"nodeTaintsPolicy" yaml:"nodeTaintsPolicy"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/TypedLocalObjectReference.go b/examples/cdk8s-sample-deployment/imports/k8s/TypedLocalObjectReference.go new file mode 100644 index 0000000..70ec16b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/TypedLocalObjectReference.go @@ -0,0 +1,15 @@ +package k8s + + +// TypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace. +type TypedLocalObjectReference struct { + // Kind is the type of resource being referenced. + Kind *string `field:"required" json:"kind" yaml:"kind"` + // Name is the name of resource being referenced. + Name *string `field:"required" json:"name" yaml:"name"` + // APIGroup is the group for the resource being referenced. + // + // If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. + ApiGroup *string `field:"optional" json:"apiGroup" yaml:"apiGroup"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/UserSubjectV1Beta1.go b/examples/cdk8s-sample-deployment/imports/k8s/UserSubjectV1Beta1.go new file mode 100644 index 0000000..c2f30e5 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/UserSubjectV1Beta1.go @@ -0,0 +1,11 @@ +package k8s + + +// UserSubject holds detailed information for user-kind subject. +type UserSubjectV1Beta1 struct { + // `name` is the username that matches, or "*" to match all usernames. + // + // Required. + Name *string `field:"required" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/UserSubjectV1Beta2.go b/examples/cdk8s-sample-deployment/imports/k8s/UserSubjectV1Beta2.go new file mode 100644 index 0000000..60d36c8 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/UserSubjectV1Beta2.go @@ -0,0 +1,11 @@ +package k8s + + +// UserSubject holds detailed information for user-kind subject. +type UserSubjectV1Beta2 struct { + // `name` is the username that matches, or "*" to match all usernames. + // + // Required. + Name *string `field:"required" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ValidatingWebhook.go b/examples/cdk8s-sample-deployment/imports/k8s/ValidatingWebhook.go new file mode 100644 index 0000000..ec3df6d --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ValidatingWebhook.go @@ -0,0 +1,91 @@ +package k8s + + +// ValidatingWebhook describes an admission webhook and the resources and operations it applies to. +type ValidatingWebhook struct { + // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. + // + // API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy. + AdmissionReviewVersions *[]*string `field:"required" json:"admissionReviewVersions" yaml:"admissionReviewVersions"` + // ClientConfig defines how to communicate with the hook. + // + // Required. + ClientConfig *WebhookClientConfig `field:"required" json:"clientConfig" yaml:"clientConfig"` + // The name of the admission webhook. + // + // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where "imagepolicy" is the name of the webhook, and kubernetes.io is the name of the organization. Required. + Name *string `field:"required" json:"name" yaml:"name"` + // SideEffects states whether this webhook has side effects. + // + // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. + SideEffects *string `field:"required" json:"sideEffects" yaml:"sideEffects"` + // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. + // + // Defaults to Fail. + // Default: Fail. + // + FailurePolicy *string `field:"optional" json:"failurePolicy" yaml:"failurePolicy"` + // matchPolicy defines how the "rules" list is used to match incoming requests. Allowed values are "Exact" or "Equivalent". + // + // - Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook. + // + // - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook. + // + // Defaults to "Equivalent". + // Default: Equivalent". + // + MatchPolicy *string `field:"optional" json:"matchPolicy" yaml:"matchPolicy"` + // NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. + // + // If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook. + // + // For example, to run the webhook on any objects whose namespace is not associated with "runlevel" of "0" or "1"; you will set the selector as follows: "namespaceSelector": { + // "matchExpressions": [ + // { + // "key": "runlevel", + // "operator": "NotIn", + // "values": [ + // "0", + // "1" + // ] + // } + // ] + // } + // + // If instead you want to only run the webhook on any objects whose namespace is associated with the "environment" of "prod" or "staging"; you will set the selector as follows: "namespaceSelector": { + // "matchExpressions": [ + // { + // "key": "environment", + // "operator": "In", + // "values": [ + // "prod", + // "staging" + // ] + // } + // ] + // } + // + // See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels for more examples of label selectors. + // + // Default to the empty LabelSelector, which matches everything. + // Default: the empty LabelSelector, which matches everything. + // + NamespaceSelector *LabelSelector `field:"optional" json:"namespaceSelector" yaml:"namespaceSelector"` + // ObjectSelector decides whether to run the webhook based on if the object has matching labels. + // + // objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything. + // Default: the empty LabelSelector, which matches everything. + // + ObjectSelector *LabelSelector `field:"optional" json:"objectSelector" yaml:"objectSelector"` + // Rules describes what operations on what resources/subresources the webhook cares about. + // + // The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. + Rules *[]*RuleWithOperations `field:"optional" json:"rules" yaml:"rules"` + // TimeoutSeconds specifies the timeout for this webhook. + // + // After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds. + // Default: 10 seconds. + // + TimeoutSeconds *float64 `field:"optional" json:"timeoutSeconds" yaml:"timeoutSeconds"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/ValidationRule.go b/examples/cdk8s-sample-deployment/imports/k8s/ValidationRule.go new file mode 100644 index 0000000..114fffe --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/ValidationRule.go @@ -0,0 +1,39 @@ +package k8s + + +// ValidationRule describes a validation rule written in the CEL expression language. +type ValidationRule struct { + // Rule represents the expression which will be evaluated by CEL. + // + // ref: https://github.com/google/cel-spec The Rule is scoped to the location of the x-kubernetes-validations extension in the schema. The `self` variable in the CEL expression is bound to the scoped value. Example: - Rule scoped to the root of a resource with a status subresource: {"rule": "self.status.actual <= self.spec.maxDesired"} + // + // If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable via `self.field` and field presence can be checked via `has(self.field)`. Null valued fields are treated as absent fields in CEL expressions. If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map are accessible via CEL macros and functions such as `self.all(...)`. If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and functions. If the Rule is scoped to a scalar, `self` is bound to the scalar value. Examples: - Rule scoped to a map of objects: {"rule": "self.components['Widget'].priority < 10"} - Rule scoped to a list of integers: {"rule": "self.values.all(value, value >= 0 && value < 100)"} - Rule scoped to a string value: {"rule": "self.startsWith('kube')"} + // + // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object and from any x-kubernetes-embedded-resource annotated objects. No other metadata properties are accessible. + // + // Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL expressions. This includes: - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields. - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as: + // - A schema with no type and x-kubernetes-preserve-unknown-fields set to true + // - An array where the items schema is of an "unknown type" + // - An object where the additionalProperties schema is of an "unknown type" + // + // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: + // "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", + // "import", "let", "loop", "package", "namespace", "return". + // Examples: + // - Rule accessing a property named "namespace": {"rule": "self.__namespace__ > 0"} + // - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop > 0"} + // - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d > 0"} + // + // Equality on arrays with x-kubernetes-list-type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type: + // - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and + // non-intersecting elements in `Y` are appended, retaining their partial order. + // - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values + // are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with + // non-intersecting keys are appended, retaining their partial order. + Rule *string `field:"required" json:"rule" yaml:"rule"` + // Message represents the message displayed when validation fails. + // + // The message is required if the Rule contains line breaks. The message must not contain line breaks. If unset, the message is "failed rule: {Rule}". e.g. "must be a URL with the host matching spec.host" + Message *string `field:"optional" json:"message" yaml:"message"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/Volume.go b/examples/cdk8s-sample-deployment/imports/k8s/Volume.go new file mode 100644 index 0000000..aaab9bb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/Volume.go @@ -0,0 +1,108 @@ +package k8s + + +// Volume represents a named volume in a pod that may be accessed by any container in the pod. +type Volume struct { + // name of the volume. + // + // Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name *string `field:"required" json:"name" yaml:"name"` + // awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + AwsElasticBlockStore *AwsElasticBlockStoreVolumeSource `field:"optional" json:"awsElasticBlockStore" yaml:"awsElasticBlockStore"` + // azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. + AzureDisk *AzureDiskVolumeSource `field:"optional" json:"azureDisk" yaml:"azureDisk"` + // azureFile represents an Azure File Service mount on the host and bind mount to the pod. + AzureFile *AzureFileVolumeSource `field:"optional" json:"azureFile" yaml:"azureFile"` + // cephFS represents a Ceph FS mount on the host that shares a pod's lifetime. + Cephfs *CephFsVolumeSource `field:"optional" json:"cephfs" yaml:"cephfs"` + // cinder represents a cinder volume attached and mounted on kubelets host machine. + // + // More info: https://examples.k8s.io/mysql-cinder-pd/README.md + Cinder *CinderVolumeSource `field:"optional" json:"cinder" yaml:"cinder"` + // configMap represents a configMap that should populate this volume. + ConfigMap *ConfigMapVolumeSource `field:"optional" json:"configMap" yaml:"configMap"` + // csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature). + Csi *CsiVolumeSource `field:"optional" json:"csi" yaml:"csi"` + // downwardAPI represents downward API about the pod that should populate this volume. + DownwardApi *DownwardApiVolumeSource `field:"optional" json:"downwardApi" yaml:"downwardApi"` + // emptyDir represents a temporary directory that shares a pod's lifetime. + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + EmptyDir *EmptyDirVolumeSource `field:"optional" json:"emptyDir" yaml:"emptyDir"` + // ephemeral represents a volume that is handled by a cluster storage driver. + // + // The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. + // + // Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity + // tracking are needed, + // c) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through + // a PersistentVolumeClaim (see EphemeralVolumeSource for more + // information on the connection between this volume type + // and PersistentVolumeClaim). + // + // Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. + // + // Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. + // + // A pod can use both types of ephemeral volumes and persistent volumes at the same time. + Ephemeral *EphemeralVolumeSource `field:"optional" json:"ephemeral" yaml:"ephemeral"` + // fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. + Fc *FcVolumeSource `field:"optional" json:"fc" yaml:"fc"` + // flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. + FlexVolume *FlexVolumeSource `field:"optional" json:"flexVolume" yaml:"flexVolume"` + // flocker represents a Flocker volume attached to a kubelet's host machine. + // + // This depends on the Flocker control service being running. + Flocker *FlockerVolumeSource `field:"optional" json:"flocker" yaml:"flocker"` + // gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + GcePersistentDisk *GcePersistentDiskVolumeSource `field:"optional" json:"gcePersistentDisk" yaml:"gcePersistentDisk"` + // gitRepo represents a git repository at a particular revision. + // + // DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container. + GitRepo *GitRepoVolumeSource `field:"optional" json:"gitRepo" yaml:"gitRepo"` + // glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + // + // More info: https://examples.k8s.io/volumes/glusterfs/README.md + Glusterfs *GlusterfsVolumeSource `field:"optional" json:"glusterfs" yaml:"glusterfs"` + // hostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. + // + // This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + HostPath *HostPathVolumeSource `field:"optional" json:"hostPath" yaml:"hostPath"` + // iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. + // + // More info: https://examples.k8s.io/volumes/iscsi/README.md + Iscsi *IscsiVolumeSource `field:"optional" json:"iscsi" yaml:"iscsi"` + // nfs represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs. + Nfs *NfsVolumeSource `field:"optional" json:"nfs" yaml:"nfs"` + // persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. + // + // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + PersistentVolumeClaim *PersistentVolumeClaimVolumeSource `field:"optional" json:"persistentVolumeClaim" yaml:"persistentVolumeClaim"` + // photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. + PhotonPersistentDisk *PhotonPersistentDiskVolumeSource `field:"optional" json:"photonPersistentDisk" yaml:"photonPersistentDisk"` + // portworxVolume represents a portworx volume attached and mounted on kubelets host machine. + PortworxVolume *PortworxVolumeSource `field:"optional" json:"portworxVolume" yaml:"portworxVolume"` + // projected items for all in one resources secrets, configmaps, and downward API. + Projected *ProjectedVolumeSource `field:"optional" json:"projected" yaml:"projected"` + // quobyte represents a Quobyte mount on the host that shares a pod's lifetime. + Quobyte *QuobyteVolumeSource `field:"optional" json:"quobyte" yaml:"quobyte"` + // rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + // + // More info: https://examples.k8s.io/volumes/rbd/README.md + Rbd *RbdVolumeSource `field:"optional" json:"rbd" yaml:"rbd"` + // scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. + ScaleIo *ScaleIoVolumeSource `field:"optional" json:"scaleIo" yaml:"scaleIo"` + // secret represents a secret that should populate this volume. + // + // More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + Secret *SecretVolumeSource `field:"optional" json:"secret" yaml:"secret"` + // storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. + Storageos *StorageOsVolumeSource `field:"optional" json:"storageos" yaml:"storageos"` + // vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine. + VsphereVolume *VsphereVirtualDiskVolumeSource `field:"optional" json:"vsphereVolume" yaml:"vsphereVolume"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/VolumeAttachmentSource.go b/examples/cdk8s-sample-deployment/imports/k8s/VolumeAttachmentSource.go new file mode 100644 index 0000000..c9d30a4 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/VolumeAttachmentSource.go @@ -0,0 +1,15 @@ +package k8s + + +// VolumeAttachmentSource represents a volume that should be attached. +// +// Right now only PersistenVolumes can be attached via external attacher, in future we may allow also inline volumes in pods. Exactly one member can be set. +type VolumeAttachmentSource struct { + // inlineVolumeSpec contains all the information necessary to attach a persistent volume defined by a pod's inline VolumeSource. + // + // This field is populated only for the CSIMigration feature. It contains translated fields from a pod's inline VolumeSource to a PersistentVolumeSpec. This field is beta-level and is only honored by servers that enabled the CSIMigration feature. + InlineVolumeSpec *PersistentVolumeSpec `field:"optional" json:"inlineVolumeSpec" yaml:"inlineVolumeSpec"` + // Name of the persistent volume to attach. + PersistentVolumeName *string `field:"optional" json:"persistentVolumeName" yaml:"persistentVolumeName"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/VolumeAttachmentSpec.go b/examples/cdk8s-sample-deployment/imports/k8s/VolumeAttachmentSpec.go new file mode 100644 index 0000000..ccb9989 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/VolumeAttachmentSpec.go @@ -0,0 +1,15 @@ +package k8s + + +// VolumeAttachmentSpec is the specification of a VolumeAttachment request. +type VolumeAttachmentSpec struct { + // Attacher indicates the name of the volume driver that MUST handle this request. + // + // This is the name returned by GetPluginName(). + Attacher *string `field:"required" json:"attacher" yaml:"attacher"` + // The node that the volume should be attached to. + NodeName *string `field:"required" json:"nodeName" yaml:"nodeName"` + // Source represents the volume that should be attached. + Source *VolumeAttachmentSource `field:"required" json:"source" yaml:"source"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/VolumeDevice.go b/examples/cdk8s-sample-deployment/imports/k8s/VolumeDevice.go new file mode 100644 index 0000000..ee0b0e3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/VolumeDevice.go @@ -0,0 +1,11 @@ +package k8s + + +// volumeDevice describes a mapping of a raw block device within a container. +type VolumeDevice struct { + // devicePath is the path inside of the container that the device will be mapped to. + DevicePath *string `field:"required" json:"devicePath" yaml:"devicePath"` + // name must match the name of a persistentVolumeClaim in the pod. + Name *string `field:"required" json:"name" yaml:"name"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/VolumeMount.go b/examples/cdk8s-sample-deployment/imports/k8s/VolumeMount.go new file mode 100644 index 0000000..48dc8eb --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/VolumeMount.go @@ -0,0 +1,35 @@ +package k8s + + +// VolumeMount describes a mounting of a Volume within a container. +type VolumeMount struct { + // Path within the container at which the volume should be mounted. + // + // Must not contain ':'. + MountPath *string `field:"required" json:"mountPath" yaml:"mountPath"` + // This must match the Name of a Volume. + Name *string `field:"required" json:"name" yaml:"name"` + // mountPropagation determines how mounts are propagated from the host to container and the other way around. + // + // When not set, MountPropagationNone is used. This field is beta in 1.10. + MountPropagation *string `field:"optional" json:"mountPropagation" yaml:"mountPropagation"` + // Mounted read-only if true, read-write otherwise (false or unspecified). + // + // Defaults to false. + // Default: false. + // + ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"` + // Path within the volume from which the container's volume should be mounted. + // + // Defaults to "" (volume's root). + // Default: volume's root). + // + SubPath *string `field:"optional" json:"subPath" yaml:"subPath"` + // Expanded path within the volume from which the container's volume should be mounted. + // + // Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to "" (volume's root). SubPathExpr and SubPath are mutually exclusive. + // Default: volume's root). SubPathExpr and SubPath are mutually exclusive. + // + SubPathExpr *string `field:"optional" json:"subPathExpr" yaml:"subPathExpr"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/VolumeNodeAffinity.go b/examples/cdk8s-sample-deployment/imports/k8s/VolumeNodeAffinity.go new file mode 100644 index 0000000..268fce3 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/VolumeNodeAffinity.go @@ -0,0 +1,9 @@ +package k8s + + +// VolumeNodeAffinity defines constraints that limit what nodes this volume can be accessed from. +type VolumeNodeAffinity struct { + // required specifies hard node constraints that must be met. + Required *NodeSelector `field:"optional" json:"required" yaml:"required"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/VolumeNodeResources.go b/examples/cdk8s-sample-deployment/imports/k8s/VolumeNodeResources.go new file mode 100644 index 0000000..5460587 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/VolumeNodeResources.go @@ -0,0 +1,11 @@ +package k8s + + +// VolumeNodeResources is a set of resource limits for scheduling of volumes. +type VolumeNodeResources struct { + // Maximum number of unique volumes managed by the CSI driver that can be used on a node. + // + // A volume that is both attached and mounted on a node is considered to be used once, not twice. The same rule applies for a unique volume that is shared among multiple pods on the same node. If this field is not specified, then the supported number of volumes on this node is unbounded. + Count *float64 `field:"optional" json:"count" yaml:"count"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/VolumeProjection.go b/examples/cdk8s-sample-deployment/imports/k8s/VolumeProjection.go new file mode 100644 index 0000000..f13ef59 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/VolumeProjection.go @@ -0,0 +1,15 @@ +package k8s + + +// Projection that may be projected along with other supported volume types. +type VolumeProjection struct { + // configMap information about the configMap data to project. + ConfigMap *ConfigMapProjection `field:"optional" json:"configMap" yaml:"configMap"` + // downwardAPI information about the downwardAPI data to project. + DownwardApi *DownwardApiProjection `field:"optional" json:"downwardApi" yaml:"downwardApi"` + // secret information about the secret data to project. + Secret *SecretProjection `field:"optional" json:"secret" yaml:"secret"` + // serviceAccountToken is information about the serviceAccountToken data to project. + ServiceAccountToken *ServiceAccountTokenProjection `field:"optional" json:"serviceAccountToken" yaml:"serviceAccountToken"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/VsphereVirtualDiskVolumeSource.go b/examples/cdk8s-sample-deployment/imports/k8s/VsphereVirtualDiskVolumeSource.go new file mode 100644 index 0000000..4395d6c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/VsphereVirtualDiskVolumeSource.go @@ -0,0 +1,17 @@ +package k8s + + +// Represents a vSphere volume resource. +type VsphereVirtualDiskVolumeSource struct { + // volumePath is the path that identifies vSphere volume vmdk. + VolumePath *string `field:"required" json:"volumePath" yaml:"volumePath"` + // fsType is filesystem type to mount. + // + // Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + FsType *string `field:"optional" json:"fsType" yaml:"fsType"` + // storagePolicyID is the storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName. + StoragePolicyId *string `field:"optional" json:"storagePolicyId" yaml:"storagePolicyId"` + // storagePolicyName is the storage Policy Based Management (SPBM) profile name. + StoragePolicyName *string `field:"optional" json:"storagePolicyName" yaml:"storagePolicyName"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/WebhookClientConfig.go b/examples/cdk8s-sample-deployment/imports/k8s/WebhookClientConfig.go new file mode 100644 index 0000000..b5df5bf --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/WebhookClientConfig.go @@ -0,0 +1,29 @@ +package k8s + + +// WebhookClientConfig contains the information to make a TLS connection with the webhook. +type WebhookClientConfig struct { + // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + // + // If unspecified, system trust roots on the apiserver are used. + CaBundle *string `field:"optional" json:"caBundle" yaml:"caBundle"` + // `service` is a reference to the service for this webhook. Either `service` or `url` must be specified. + // + // If the webhook is running within the cluster, then you should use `service`. + Service *ServiceReference `field:"optional" json:"service" yaml:"service"` + // `url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). + // + // Exactly one of `url` or `service` must be specified. + // + // The `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address. + // + // Please note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. + // + // The scheme must be "https"; the URL must begin with "https://". + // + // A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. + // + // Attempting to use a user or basic auth e.g. "user:password@" is not allowed. Fragments ("#...") and query parameters ("?...") are not allowed, either. + Url *string `field:"optional" json:"url" yaml:"url"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/WebhookConversion.go b/examples/cdk8s-sample-deployment/imports/k8s/WebhookConversion.go new file mode 100644 index 0000000..e9e5dc1 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/WebhookConversion.go @@ -0,0 +1,13 @@ +package k8s + + +// WebhookConversion describes how to call a conversion webhook. +type WebhookConversion struct { + // conversionReviewVersions is an ordered list of preferred `ConversionReview` versions the Webhook expects. + // + // The API server will use the first version in the list which it supports. If none of the versions specified in this list are supported by API server, conversion will fail for the custom resource. If a persisted Webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail. + ConversionReviewVersions *[]*string `field:"required" json:"conversionReviewVersions" yaml:"conversionReviewVersions"` + // clientConfig is the instructions for how to call the webhook if strategy is `Webhook`. + ClientConfig *WebhookClientConfig `field:"optional" json:"clientConfig" yaml:"clientConfig"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/WeightedPodAffinityTerm.go b/examples/cdk8s-sample-deployment/imports/k8s/WeightedPodAffinityTerm.go new file mode 100644 index 0000000..2fc8427 --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/WeightedPodAffinityTerm.go @@ -0,0 +1,13 @@ +package k8s + + +// The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s). +type WeightedPodAffinityTerm struct { + // Required. + // + // A pod affinity term, associated with the corresponding weight. + PodAffinityTerm *PodAffinityTerm `field:"required" json:"podAffinityTerm" yaml:"podAffinityTerm"` + // weight associated with matching the corresponding podAffinityTerm, in the range 1-100. + Weight *float64 `field:"required" json:"weight" yaml:"weight"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/WindowsSecurityContextOptions.go b/examples/cdk8s-sample-deployment/imports/k8s/WindowsSecurityContextOptions.go new file mode 100644 index 0000000..85fa4cd --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/WindowsSecurityContextOptions.go @@ -0,0 +1,21 @@ +package k8s + + +// WindowsSecurityContextOptions contain Windows-specific options and credentials. +type WindowsSecurityContextOptions struct { + // GMSACredentialSpec is where the GMSA admission webhook (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the GMSA credential spec named by the GMSACredentialSpecName field. + GmsaCredentialSpec *string `field:"optional" json:"gmsaCredentialSpec" yaml:"gmsaCredentialSpec"` + // GMSACredentialSpecName is the name of the GMSA credential spec to use. + GmsaCredentialSpecName *string `field:"optional" json:"gmsaCredentialSpecName" yaml:"gmsaCredentialSpecName"` + // HostProcess determines if a container should be run as a 'Host Process' container. + // + // This field is alpha-level and will only be honored by components that enable the WindowsHostProcessContainers feature flag. Setting this field without the feature flag will result in errors when validating the Pod. All of a Pod's containers must have the same effective HostProcess value (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). In addition, if HostProcess is true then HostNetwork must also be set to true. + HostProcess *bool `field:"optional" json:"hostProcess" yaml:"hostProcess"` + // The UserName in Windows to run the entrypoint of the container process. + // + // Defaults to the user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + // Default: the user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + // + RunAsUserName *string `field:"optional" json:"runAsUserName" yaml:"runAsUserName"` +} + diff --git a/examples/cdk8s-sample-deployment/imports/k8s/internal/types.go b/examples/cdk8s-sample-deployment/imports/k8s/internal/types.go new file mode 100644 index 0000000..de3a04f --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/internal/types.go @@ -0,0 +1,5 @@ +package internal +import ( + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) +type Type__cdk8sApiObject = cdk8s.ApiObject diff --git a/examples/cdk8s-sample-deployment/imports/k8s/jsii/jsii.go b/examples/cdk8s-sample-deployment/imports/k8s/jsii/jsii.go new file mode 100644 index 0000000..61d738b --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/jsii/jsii.go @@ -0,0 +1,28 @@ +// Package jsii contains the functionaility needed for jsii packages to +// initialize their dependencies and themselves. Users should never need to use this package +// directly. If you find you need to - please report a bug at +// https://github.com/aws/jsii/issues/new/choose +package jsii + +import ( + _ "embed" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + + constructs "github.com/aws/constructs-go/constructs/v10/jsii" + cdk8s "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2/jsii" +) + +//go:embed k8s-0.0.0.tgz +var tarball []byte + +// Initialize loads the necessary packages in the @jsii/kernel to support the enclosing module. +// The implementation is idempotent (and hence safe to be called over and over). +func Initialize() { + // Ensure all dependencies are initialized + cdk8s.Initialize() + constructs.Initialize() + + // Load this library into the kernel + _jsii_.Load("k8s", "0.0.0", tarball) +} diff --git a/examples/cdk8s-sample-deployment/imports/k8s/jsii/k8s-0.0.0.tgz b/examples/cdk8s-sample-deployment/imports/k8s/jsii/k8s-0.0.0.tgz new file mode 100644 index 0000000..4723ad2 Binary files /dev/null and b/examples/cdk8s-sample-deployment/imports/k8s/jsii/k8s-0.0.0.tgz differ diff --git a/examples/cdk8s-sample-deployment/imports/k8s/main.go b/examples/cdk8s-sample-deployment/imports/k8s/main.go new file mode 100644 index 0000000..ecf81de --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/main.go @@ -0,0 +1,4262 @@ +// k8s +package k8s + +import ( + "reflect" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" +) + +func init() { + _jsii_.RegisterStruct( + "k8s.Affinity", + reflect.TypeOf((*Affinity)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.AggregationRule", + reflect.TypeOf((*AggregationRule)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ApiServiceSpec", + reflect.TypeOf((*ApiServiceSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.AwsElasticBlockStoreVolumeSource", + reflect.TypeOf((*AwsElasticBlockStoreVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.AzureDiskVolumeSource", + reflect.TypeOf((*AzureDiskVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.AzureFilePersistentVolumeSource", + reflect.TypeOf((*AzureFilePersistentVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.AzureFileVolumeSource", + reflect.TypeOf((*AzureFileVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.BoundObjectReference", + reflect.TypeOf((*BoundObjectReference)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Capabilities", + reflect.TypeOf((*Capabilities)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CephFsPersistentVolumeSource", + reflect.TypeOf((*CephFsPersistentVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CephFsVolumeSource", + reflect.TypeOf((*CephFsVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CertificateSigningRequestSpec", + reflect.TypeOf((*CertificateSigningRequestSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CinderPersistentVolumeSource", + reflect.TypeOf((*CinderPersistentVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CinderVolumeSource", + reflect.TypeOf((*CinderVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ClientIpConfig", + reflect.TypeOf((*ClientIpConfig)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ClusterCidrSpecV1Alpha1", + reflect.TypeOf((*ClusterCidrSpecV1Alpha1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ComponentCondition", + reflect.TypeOf((*ComponentCondition)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ConfigMapEnvSource", + reflect.TypeOf((*ConfigMapEnvSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ConfigMapKeySelector", + reflect.TypeOf((*ConfigMapKeySelector)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ConfigMapNodeConfigSource", + reflect.TypeOf((*ConfigMapNodeConfigSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ConfigMapProjection", + reflect.TypeOf((*ConfigMapProjection)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ConfigMapVolumeSource", + reflect.TypeOf((*ConfigMapVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Container", + reflect.TypeOf((*Container)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ContainerPort", + reflect.TypeOf((*ContainerPort)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ContainerResourceMetricSourceV2", + reflect.TypeOf((*ContainerResourceMetricSourceV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ContainerResourceMetricSourceV2Beta2", + reflect.TypeOf((*ContainerResourceMetricSourceV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CronJobSpec", + reflect.TypeOf((*CronJobSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CrossVersionObjectReference", + reflect.TypeOf((*CrossVersionObjectReference)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CrossVersionObjectReferenceV2", + reflect.TypeOf((*CrossVersionObjectReferenceV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CrossVersionObjectReferenceV2Beta2", + reflect.TypeOf((*CrossVersionObjectReferenceV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CsiDriverSpec", + reflect.TypeOf((*CsiDriverSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CsiNodeDriver", + reflect.TypeOf((*CsiNodeDriver)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CsiNodeSpec", + reflect.TypeOf((*CsiNodeSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CsiPersistentVolumeSource", + reflect.TypeOf((*CsiPersistentVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CsiVolumeSource", + reflect.TypeOf((*CsiVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CustomResourceColumnDefinition", + reflect.TypeOf((*CustomResourceColumnDefinition)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CustomResourceConversion", + reflect.TypeOf((*CustomResourceConversion)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CustomResourceDefinitionNames", + reflect.TypeOf((*CustomResourceDefinitionNames)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CustomResourceDefinitionSpec", + reflect.TypeOf((*CustomResourceDefinitionSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CustomResourceDefinitionVersion", + reflect.TypeOf((*CustomResourceDefinitionVersion)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CustomResourceSubresourceScale", + reflect.TypeOf((*CustomResourceSubresourceScale)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CustomResourceSubresources", + reflect.TypeOf((*CustomResourceSubresources)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.CustomResourceValidation", + reflect.TypeOf((*CustomResourceValidation)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.DaemonSetSpec", + reflect.TypeOf((*DaemonSetSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.DaemonSetUpdateStrategy", + reflect.TypeOf((*DaemonSetUpdateStrategy)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.DeleteOptions", + reflect.TypeOf((*DeleteOptions)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.DeploymentSpec", + reflect.TypeOf((*DeploymentSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.DeploymentStrategy", + reflect.TypeOf((*DeploymentStrategy)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.DownwardApiProjection", + reflect.TypeOf((*DownwardApiProjection)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.DownwardApiVolumeFile", + reflect.TypeOf((*DownwardApiVolumeFile)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.DownwardApiVolumeSource", + reflect.TypeOf((*DownwardApiVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EmptyDirVolumeSource", + reflect.TypeOf((*EmptyDirVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Endpoint", + reflect.TypeOf((*Endpoint)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EndpointAddress", + reflect.TypeOf((*EndpointAddress)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EndpointConditions", + reflect.TypeOf((*EndpointConditions)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EndpointHints", + reflect.TypeOf((*EndpointHints)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EndpointPort", + reflect.TypeOf((*EndpointPort)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EndpointSubset", + reflect.TypeOf((*EndpointSubset)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EnvFromSource", + reflect.TypeOf((*EnvFromSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EnvVar", + reflect.TypeOf((*EnvVar)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EnvVarSource", + reflect.TypeOf((*EnvVarSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EphemeralContainer", + reflect.TypeOf((*EphemeralContainer)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EphemeralVolumeSource", + reflect.TypeOf((*EphemeralVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EventSeries", + reflect.TypeOf((*EventSeries)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.EventSource", + reflect.TypeOf((*EventSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ExecAction", + reflect.TypeOf((*ExecAction)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ExternalDocumentation", + reflect.TypeOf((*ExternalDocumentation)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ExternalMetricSourceV2", + reflect.TypeOf((*ExternalMetricSourceV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ExternalMetricSourceV2Beta2", + reflect.TypeOf((*ExternalMetricSourceV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.FcVolumeSource", + reflect.TypeOf((*FcVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.FlexPersistentVolumeSource", + reflect.TypeOf((*FlexPersistentVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.FlexVolumeSource", + reflect.TypeOf((*FlexVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.FlockerVolumeSource", + reflect.TypeOf((*FlockerVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.FlowDistinguisherMethodV1Beta1", + reflect.TypeOf((*FlowDistinguisherMethodV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.FlowDistinguisherMethodV1Beta2", + reflect.TypeOf((*FlowDistinguisherMethodV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.FlowSchemaSpecV1Beta1", + reflect.TypeOf((*FlowSchemaSpecV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.FlowSchemaSpecV1Beta2", + reflect.TypeOf((*FlowSchemaSpecV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ForZone", + reflect.TypeOf((*ForZone)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.GcePersistentDiskVolumeSource", + reflect.TypeOf((*GcePersistentDiskVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.GitRepoVolumeSource", + reflect.TypeOf((*GitRepoVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.GlusterfsPersistentVolumeSource", + reflect.TypeOf((*GlusterfsPersistentVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.GlusterfsVolumeSource", + reflect.TypeOf((*GlusterfsVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.GroupSubjectV1Beta1", + reflect.TypeOf((*GroupSubjectV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.GroupSubjectV1Beta2", + reflect.TypeOf((*GroupSubjectV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.GrpcAction", + reflect.TypeOf((*GrpcAction)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HorizontalPodAutoscalerBehaviorV2", + reflect.TypeOf((*HorizontalPodAutoscalerBehaviorV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HorizontalPodAutoscalerBehaviorV2Beta2", + reflect.TypeOf((*HorizontalPodAutoscalerBehaviorV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HorizontalPodAutoscalerSpec", + reflect.TypeOf((*HorizontalPodAutoscalerSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HorizontalPodAutoscalerSpecV2", + reflect.TypeOf((*HorizontalPodAutoscalerSpecV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HorizontalPodAutoscalerSpecV2Beta2", + reflect.TypeOf((*HorizontalPodAutoscalerSpecV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HostAlias", + reflect.TypeOf((*HostAlias)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HostPathVolumeSource", + reflect.TypeOf((*HostPathVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HpaScalingPolicyV2", + reflect.TypeOf((*HpaScalingPolicyV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HpaScalingPolicyV2Beta2", + reflect.TypeOf((*HpaScalingPolicyV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HpaScalingRulesV2", + reflect.TypeOf((*HpaScalingRulesV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HpaScalingRulesV2Beta2", + reflect.TypeOf((*HpaScalingRulesV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HttpGetAction", + reflect.TypeOf((*HttpGetAction)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HttpHeader", + reflect.TypeOf((*HttpHeader)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HttpIngressPath", + reflect.TypeOf((*HttpIngressPath)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.HttpIngressRuleValue", + reflect.TypeOf((*HttpIngressRuleValue)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.IngressBackend", + reflect.TypeOf((*IngressBackend)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.IngressClassParametersReference", + reflect.TypeOf((*IngressClassParametersReference)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.IngressClassSpec", + reflect.TypeOf((*IngressClassSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.IngressRule", + reflect.TypeOf((*IngressRule)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.IngressServiceBackend", + reflect.TypeOf((*IngressServiceBackend)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.IngressSpec", + reflect.TypeOf((*IngressSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.IngressTls", + reflect.TypeOf((*IngressTls)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.IntOrString", + reflect.TypeOf((*IntOrString)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberProperty{JsiiProperty: "value", GoGetter: "Value"}, + }, + func() interface{} { + return &jsiiProxy_IntOrString{} + }, + ) + _jsii_.RegisterEnum( + "k8s.IoK8SApimachineryPkgApisMetaV1DeleteOptionsKind", + reflect.TypeOf((*IoK8SApimachineryPkgApisMetaV1DeleteOptionsKind)(nil)).Elem(), + map[string]interface{}{ + "DELETE_OPTIONS": IoK8SApimachineryPkgApisMetaV1DeleteOptionsKind_DELETE_OPTIONS, + }, + ) + _jsii_.RegisterStruct( + "k8s.IpBlock", + reflect.TypeOf((*IpBlock)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.IscsiPersistentVolumeSource", + reflect.TypeOf((*IscsiPersistentVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.IscsiVolumeSource", + reflect.TypeOf((*IscsiVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.JobSpec", + reflect.TypeOf((*JobSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.JobTemplateSpec", + reflect.TypeOf((*JobTemplateSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.JsonSchemaProps", + reflect.TypeOf((*JsonSchemaProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KeyToPath", + reflect.TypeOf((*KeyToPath)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeApiService", + reflect.TypeOf((*KubeApiService)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeApiService{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeApiServiceList", + reflect.TypeOf((*KubeApiServiceList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeApiServiceList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeApiServiceListProps", + reflect.TypeOf((*KubeApiServiceListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeApiServiceProps", + reflect.TypeOf((*KubeApiServiceProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeBinding", + reflect.TypeOf((*KubeBinding)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeBinding{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeBindingProps", + reflect.TypeOf((*KubeBindingProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeCertificateSigningRequest", + reflect.TypeOf((*KubeCertificateSigningRequest)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCertificateSigningRequest{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeCertificateSigningRequestList", + reflect.TypeOf((*KubeCertificateSigningRequestList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCertificateSigningRequestList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeCertificateSigningRequestListProps", + reflect.TypeOf((*KubeCertificateSigningRequestListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeCertificateSigningRequestProps", + reflect.TypeOf((*KubeCertificateSigningRequestProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeClusterCidrListV1Alpha1", + reflect.TypeOf((*KubeClusterCidrListV1Alpha1)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeClusterCidrListV1Alpha1{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeClusterCidrListV1Alpha1Props", + reflect.TypeOf((*KubeClusterCidrListV1Alpha1Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeClusterCidrv1Alpha1", + reflect.TypeOf((*KubeClusterCidrv1Alpha1)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeClusterCidrv1Alpha1{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeClusterCidrv1Alpha1Props", + reflect.TypeOf((*KubeClusterCidrv1Alpha1Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeClusterRole", + reflect.TypeOf((*KubeClusterRole)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeClusterRole{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeClusterRoleBinding", + reflect.TypeOf((*KubeClusterRoleBinding)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeClusterRoleBinding{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeClusterRoleBindingList", + reflect.TypeOf((*KubeClusterRoleBindingList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeClusterRoleBindingList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeClusterRoleBindingListProps", + reflect.TypeOf((*KubeClusterRoleBindingListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeClusterRoleBindingProps", + reflect.TypeOf((*KubeClusterRoleBindingProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeClusterRoleList", + reflect.TypeOf((*KubeClusterRoleList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeClusterRoleList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeClusterRoleListProps", + reflect.TypeOf((*KubeClusterRoleListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeClusterRoleProps", + reflect.TypeOf((*KubeClusterRoleProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeComponentStatus", + reflect.TypeOf((*KubeComponentStatus)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeComponentStatus{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeComponentStatusList", + reflect.TypeOf((*KubeComponentStatusList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeComponentStatusList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeComponentStatusListProps", + reflect.TypeOf((*KubeComponentStatusListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeComponentStatusProps", + reflect.TypeOf((*KubeComponentStatusProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeConfigMap", + reflect.TypeOf((*KubeConfigMap)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeConfigMap{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeConfigMapList", + reflect.TypeOf((*KubeConfigMapList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeConfigMapList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeConfigMapListProps", + reflect.TypeOf((*KubeConfigMapListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeConfigMapProps", + reflect.TypeOf((*KubeConfigMapProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeControllerRevision", + reflect.TypeOf((*KubeControllerRevision)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeControllerRevision{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeControllerRevisionList", + reflect.TypeOf((*KubeControllerRevisionList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeControllerRevisionList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeControllerRevisionListProps", + reflect.TypeOf((*KubeControllerRevisionListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeControllerRevisionProps", + reflect.TypeOf((*KubeControllerRevisionProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeCronJob", + reflect.TypeOf((*KubeCronJob)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCronJob{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeCronJobList", + reflect.TypeOf((*KubeCronJobList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCronJobList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeCronJobListProps", + reflect.TypeOf((*KubeCronJobListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeCronJobProps", + reflect.TypeOf((*KubeCronJobProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeCsiDriver", + reflect.TypeOf((*KubeCsiDriver)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCsiDriver{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeCsiDriverList", + reflect.TypeOf((*KubeCsiDriverList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCsiDriverList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeCsiDriverListProps", + reflect.TypeOf((*KubeCsiDriverListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeCsiDriverProps", + reflect.TypeOf((*KubeCsiDriverProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeCsiNode", + reflect.TypeOf((*KubeCsiNode)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCsiNode{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeCsiNodeList", + reflect.TypeOf((*KubeCsiNodeList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCsiNodeList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeCsiNodeListProps", + reflect.TypeOf((*KubeCsiNodeListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeCsiNodeProps", + reflect.TypeOf((*KubeCsiNodeProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeCsiStorageCapacity", + reflect.TypeOf((*KubeCsiStorageCapacity)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCsiStorageCapacity{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeCsiStorageCapacityList", + reflect.TypeOf((*KubeCsiStorageCapacityList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCsiStorageCapacityList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeCsiStorageCapacityListProps", + reflect.TypeOf((*KubeCsiStorageCapacityListProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeCsiStorageCapacityListV1Beta1", + reflect.TypeOf((*KubeCsiStorageCapacityListV1Beta1)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCsiStorageCapacityListV1Beta1{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeCsiStorageCapacityListV1Beta1Props", + reflect.TypeOf((*KubeCsiStorageCapacityListV1Beta1Props)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeCsiStorageCapacityProps", + reflect.TypeOf((*KubeCsiStorageCapacityProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeCsiStorageCapacityV1Beta1", + reflect.TypeOf((*KubeCsiStorageCapacityV1Beta1)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCsiStorageCapacityV1Beta1{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeCsiStorageCapacityV1Beta1Props", + reflect.TypeOf((*KubeCsiStorageCapacityV1Beta1Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeCustomResourceDefinition", + reflect.TypeOf((*KubeCustomResourceDefinition)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCustomResourceDefinition{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeCustomResourceDefinitionList", + reflect.TypeOf((*KubeCustomResourceDefinitionList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeCustomResourceDefinitionList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeCustomResourceDefinitionListProps", + reflect.TypeOf((*KubeCustomResourceDefinitionListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeCustomResourceDefinitionProps", + reflect.TypeOf((*KubeCustomResourceDefinitionProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeDaemonSet", + reflect.TypeOf((*KubeDaemonSet)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeDaemonSet{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeDaemonSetList", + reflect.TypeOf((*KubeDaemonSetList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeDaemonSetList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeDaemonSetListProps", + reflect.TypeOf((*KubeDaemonSetListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeDaemonSetProps", + reflect.TypeOf((*KubeDaemonSetProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeDeployment", + reflect.TypeOf((*KubeDeployment)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeDeployment{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeDeploymentList", + reflect.TypeOf((*KubeDeploymentList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeDeploymentList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeDeploymentListProps", + reflect.TypeOf((*KubeDeploymentListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeDeploymentProps", + reflect.TypeOf((*KubeDeploymentProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeEndpointSlice", + reflect.TypeOf((*KubeEndpointSlice)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeEndpointSlice{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeEndpointSliceList", + reflect.TypeOf((*KubeEndpointSliceList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeEndpointSliceList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeEndpointSliceListProps", + reflect.TypeOf((*KubeEndpointSliceListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeEndpointSliceProps", + reflect.TypeOf((*KubeEndpointSliceProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeEndpoints", + reflect.TypeOf((*KubeEndpoints)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeEndpoints{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeEndpointsList", + reflect.TypeOf((*KubeEndpointsList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeEndpointsList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeEndpointsListProps", + reflect.TypeOf((*KubeEndpointsListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeEndpointsProps", + reflect.TypeOf((*KubeEndpointsProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeEvent", + reflect.TypeOf((*KubeEvent)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeEvent{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeEventList", + reflect.TypeOf((*KubeEventList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeEventList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeEventListProps", + reflect.TypeOf((*KubeEventListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeEventProps", + reflect.TypeOf((*KubeEventProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeEviction", + reflect.TypeOf((*KubeEviction)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeEviction{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeEvictionProps", + reflect.TypeOf((*KubeEvictionProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeFlowSchemaListV1Beta1", + reflect.TypeOf((*KubeFlowSchemaListV1Beta1)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeFlowSchemaListV1Beta1{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeFlowSchemaListV1Beta1Props", + reflect.TypeOf((*KubeFlowSchemaListV1Beta1Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeFlowSchemaListV1Beta2", + reflect.TypeOf((*KubeFlowSchemaListV1Beta2)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeFlowSchemaListV1Beta2{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeFlowSchemaListV1Beta2Props", + reflect.TypeOf((*KubeFlowSchemaListV1Beta2Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeFlowSchemaV1Beta1", + reflect.TypeOf((*KubeFlowSchemaV1Beta1)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeFlowSchemaV1Beta1{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeFlowSchemaV1Beta1Props", + reflect.TypeOf((*KubeFlowSchemaV1Beta1Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeFlowSchemaV1Beta2", + reflect.TypeOf((*KubeFlowSchemaV1Beta2)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeFlowSchemaV1Beta2{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeFlowSchemaV1Beta2Props", + reflect.TypeOf((*KubeFlowSchemaV1Beta2Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeHorizontalPodAutoscaler", + reflect.TypeOf((*KubeHorizontalPodAutoscaler)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeHorizontalPodAutoscaler{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeHorizontalPodAutoscalerList", + reflect.TypeOf((*KubeHorizontalPodAutoscalerList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeHorizontalPodAutoscalerList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeHorizontalPodAutoscalerListProps", + reflect.TypeOf((*KubeHorizontalPodAutoscalerListProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeHorizontalPodAutoscalerListV2", + reflect.TypeOf((*KubeHorizontalPodAutoscalerListV2)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeHorizontalPodAutoscalerListV2{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeHorizontalPodAutoscalerListV2Beta2", + reflect.TypeOf((*KubeHorizontalPodAutoscalerListV2Beta2)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeHorizontalPodAutoscalerListV2Beta2{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeHorizontalPodAutoscalerListV2Beta2Props", + reflect.TypeOf((*KubeHorizontalPodAutoscalerListV2Beta2Props)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeHorizontalPodAutoscalerListV2Props", + reflect.TypeOf((*KubeHorizontalPodAutoscalerListV2Props)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeHorizontalPodAutoscalerProps", + reflect.TypeOf((*KubeHorizontalPodAutoscalerProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeHorizontalPodAutoscalerV2", + reflect.TypeOf((*KubeHorizontalPodAutoscalerV2)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeHorizontalPodAutoscalerV2{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeHorizontalPodAutoscalerV2Beta2", + reflect.TypeOf((*KubeHorizontalPodAutoscalerV2Beta2)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeHorizontalPodAutoscalerV2Beta2{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeHorizontalPodAutoscalerV2Beta2Props", + reflect.TypeOf((*KubeHorizontalPodAutoscalerV2Beta2Props)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeHorizontalPodAutoscalerV2Props", + reflect.TypeOf((*KubeHorizontalPodAutoscalerV2Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeIngress", + reflect.TypeOf((*KubeIngress)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeIngress{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeIngressClass", + reflect.TypeOf((*KubeIngressClass)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeIngressClass{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeIngressClassList", + reflect.TypeOf((*KubeIngressClassList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeIngressClassList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeIngressClassListProps", + reflect.TypeOf((*KubeIngressClassListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeIngressClassProps", + reflect.TypeOf((*KubeIngressClassProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeIngressList", + reflect.TypeOf((*KubeIngressList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeIngressList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeIngressListProps", + reflect.TypeOf((*KubeIngressListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeIngressProps", + reflect.TypeOf((*KubeIngressProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeJob", + reflect.TypeOf((*KubeJob)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeJob{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeJobList", + reflect.TypeOf((*KubeJobList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeJobList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeJobListProps", + reflect.TypeOf((*KubeJobListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeJobProps", + reflect.TypeOf((*KubeJobProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeLease", + reflect.TypeOf((*KubeLease)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeLease{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeLeaseList", + reflect.TypeOf((*KubeLeaseList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeLeaseList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeLeaseListProps", + reflect.TypeOf((*KubeLeaseListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeLeaseProps", + reflect.TypeOf((*KubeLeaseProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeLimitRange", + reflect.TypeOf((*KubeLimitRange)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeLimitRange{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeLimitRangeList", + reflect.TypeOf((*KubeLimitRangeList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeLimitRangeList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeLimitRangeListProps", + reflect.TypeOf((*KubeLimitRangeListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeLimitRangeProps", + reflect.TypeOf((*KubeLimitRangeProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeLocalSubjectAccessReview", + reflect.TypeOf((*KubeLocalSubjectAccessReview)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeLocalSubjectAccessReview{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeLocalSubjectAccessReviewProps", + reflect.TypeOf((*KubeLocalSubjectAccessReviewProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeMutatingWebhookConfiguration", + reflect.TypeOf((*KubeMutatingWebhookConfiguration)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeMutatingWebhookConfiguration{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeMutatingWebhookConfigurationList", + reflect.TypeOf((*KubeMutatingWebhookConfigurationList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeMutatingWebhookConfigurationList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeMutatingWebhookConfigurationListProps", + reflect.TypeOf((*KubeMutatingWebhookConfigurationListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeMutatingWebhookConfigurationProps", + reflect.TypeOf((*KubeMutatingWebhookConfigurationProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeNamespace", + reflect.TypeOf((*KubeNamespace)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeNamespace{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeNamespaceList", + reflect.TypeOf((*KubeNamespaceList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeNamespaceList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeNamespaceListProps", + reflect.TypeOf((*KubeNamespaceListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeNamespaceProps", + reflect.TypeOf((*KubeNamespaceProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeNetworkPolicy", + reflect.TypeOf((*KubeNetworkPolicy)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeNetworkPolicy{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeNetworkPolicyList", + reflect.TypeOf((*KubeNetworkPolicyList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeNetworkPolicyList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeNetworkPolicyListProps", + reflect.TypeOf((*KubeNetworkPolicyListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeNetworkPolicyProps", + reflect.TypeOf((*KubeNetworkPolicyProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeNode", + reflect.TypeOf((*KubeNode)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeNode{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeNodeList", + reflect.TypeOf((*KubeNodeList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeNodeList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeNodeListProps", + reflect.TypeOf((*KubeNodeListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeNodeProps", + reflect.TypeOf((*KubeNodeProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubePersistentVolume", + reflect.TypeOf((*KubePersistentVolume)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePersistentVolume{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubePersistentVolumeClaim", + reflect.TypeOf((*KubePersistentVolumeClaim)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePersistentVolumeClaim{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubePersistentVolumeClaimList", + reflect.TypeOf((*KubePersistentVolumeClaimList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePersistentVolumeClaimList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubePersistentVolumeClaimListProps", + reflect.TypeOf((*KubePersistentVolumeClaimListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubePersistentVolumeClaimProps", + reflect.TypeOf((*KubePersistentVolumeClaimProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubePersistentVolumeList", + reflect.TypeOf((*KubePersistentVolumeList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePersistentVolumeList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubePersistentVolumeListProps", + reflect.TypeOf((*KubePersistentVolumeListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubePersistentVolumeProps", + reflect.TypeOf((*KubePersistentVolumeProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubePod", + reflect.TypeOf((*KubePod)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePod{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubePodDisruptionBudget", + reflect.TypeOf((*KubePodDisruptionBudget)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePodDisruptionBudget{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubePodDisruptionBudgetList", + reflect.TypeOf((*KubePodDisruptionBudgetList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePodDisruptionBudgetList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubePodDisruptionBudgetListProps", + reflect.TypeOf((*KubePodDisruptionBudgetListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubePodDisruptionBudgetProps", + reflect.TypeOf((*KubePodDisruptionBudgetProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubePodList", + reflect.TypeOf((*KubePodList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePodList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubePodListProps", + reflect.TypeOf((*KubePodListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubePodProps", + reflect.TypeOf((*KubePodProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubePodTemplate", + reflect.TypeOf((*KubePodTemplate)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePodTemplate{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubePodTemplateList", + reflect.TypeOf((*KubePodTemplateList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePodTemplateList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubePodTemplateListProps", + reflect.TypeOf((*KubePodTemplateListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubePodTemplateProps", + reflect.TypeOf((*KubePodTemplateProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubePriorityClass", + reflect.TypeOf((*KubePriorityClass)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePriorityClass{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubePriorityClassList", + reflect.TypeOf((*KubePriorityClassList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePriorityClassList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubePriorityClassListProps", + reflect.TypeOf((*KubePriorityClassListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubePriorityClassProps", + reflect.TypeOf((*KubePriorityClassProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubePriorityLevelConfigurationListV1Beta1", + reflect.TypeOf((*KubePriorityLevelConfigurationListV1Beta1)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePriorityLevelConfigurationListV1Beta1{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubePriorityLevelConfigurationListV1Beta1Props", + reflect.TypeOf((*KubePriorityLevelConfigurationListV1Beta1Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubePriorityLevelConfigurationListV1Beta2", + reflect.TypeOf((*KubePriorityLevelConfigurationListV1Beta2)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePriorityLevelConfigurationListV1Beta2{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubePriorityLevelConfigurationListV1Beta2Props", + reflect.TypeOf((*KubePriorityLevelConfigurationListV1Beta2Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubePriorityLevelConfigurationV1Beta1", + reflect.TypeOf((*KubePriorityLevelConfigurationV1Beta1)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePriorityLevelConfigurationV1Beta1{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubePriorityLevelConfigurationV1Beta1Props", + reflect.TypeOf((*KubePriorityLevelConfigurationV1Beta1Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubePriorityLevelConfigurationV1Beta2", + reflect.TypeOf((*KubePriorityLevelConfigurationV1Beta2)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubePriorityLevelConfigurationV1Beta2{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubePriorityLevelConfigurationV1Beta2Props", + reflect.TypeOf((*KubePriorityLevelConfigurationV1Beta2Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeReplicaSet", + reflect.TypeOf((*KubeReplicaSet)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeReplicaSet{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeReplicaSetList", + reflect.TypeOf((*KubeReplicaSetList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeReplicaSetList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeReplicaSetListProps", + reflect.TypeOf((*KubeReplicaSetListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeReplicaSetProps", + reflect.TypeOf((*KubeReplicaSetProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeReplicationController", + reflect.TypeOf((*KubeReplicationController)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeReplicationController{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeReplicationControllerList", + reflect.TypeOf((*KubeReplicationControllerList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeReplicationControllerList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeReplicationControllerListProps", + reflect.TypeOf((*KubeReplicationControllerListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeReplicationControllerProps", + reflect.TypeOf((*KubeReplicationControllerProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeResourceQuota", + reflect.TypeOf((*KubeResourceQuota)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeResourceQuota{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeResourceQuotaList", + reflect.TypeOf((*KubeResourceQuotaList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeResourceQuotaList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeResourceQuotaListProps", + reflect.TypeOf((*KubeResourceQuotaListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeResourceQuotaProps", + reflect.TypeOf((*KubeResourceQuotaProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeRole", + reflect.TypeOf((*KubeRole)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeRole{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeRoleBinding", + reflect.TypeOf((*KubeRoleBinding)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeRoleBinding{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeRoleBindingList", + reflect.TypeOf((*KubeRoleBindingList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeRoleBindingList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeRoleBindingListProps", + reflect.TypeOf((*KubeRoleBindingListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeRoleBindingProps", + reflect.TypeOf((*KubeRoleBindingProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeRoleList", + reflect.TypeOf((*KubeRoleList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeRoleList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeRoleListProps", + reflect.TypeOf((*KubeRoleListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeRoleProps", + reflect.TypeOf((*KubeRoleProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeRuntimeClass", + reflect.TypeOf((*KubeRuntimeClass)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeRuntimeClass{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeRuntimeClassList", + reflect.TypeOf((*KubeRuntimeClassList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeRuntimeClassList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeRuntimeClassListProps", + reflect.TypeOf((*KubeRuntimeClassListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeRuntimeClassProps", + reflect.TypeOf((*KubeRuntimeClassProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeScale", + reflect.TypeOf((*KubeScale)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeScale{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeScaleProps", + reflect.TypeOf((*KubeScaleProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeSecret", + reflect.TypeOf((*KubeSecret)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeSecret{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeSecretList", + reflect.TypeOf((*KubeSecretList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeSecretList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeSecretListProps", + reflect.TypeOf((*KubeSecretListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeSecretProps", + reflect.TypeOf((*KubeSecretProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeSelfSubjectAccessReview", + reflect.TypeOf((*KubeSelfSubjectAccessReview)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeSelfSubjectAccessReview{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeSelfSubjectAccessReviewProps", + reflect.TypeOf((*KubeSelfSubjectAccessReviewProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeSelfSubjectRulesReview", + reflect.TypeOf((*KubeSelfSubjectRulesReview)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeSelfSubjectRulesReview{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeSelfSubjectRulesReviewProps", + reflect.TypeOf((*KubeSelfSubjectRulesReviewProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeService", + reflect.TypeOf((*KubeService)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeService{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeServiceAccount", + reflect.TypeOf((*KubeServiceAccount)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeServiceAccount{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeServiceAccountList", + reflect.TypeOf((*KubeServiceAccountList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeServiceAccountList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeServiceAccountListProps", + reflect.TypeOf((*KubeServiceAccountListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeServiceAccountProps", + reflect.TypeOf((*KubeServiceAccountProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeServiceList", + reflect.TypeOf((*KubeServiceList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeServiceList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeServiceListProps", + reflect.TypeOf((*KubeServiceListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeServiceProps", + reflect.TypeOf((*KubeServiceProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeStatefulSet", + reflect.TypeOf((*KubeStatefulSet)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeStatefulSet{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeStatefulSetList", + reflect.TypeOf((*KubeStatefulSetList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeStatefulSetList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeStatefulSetListProps", + reflect.TypeOf((*KubeStatefulSetListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeStatefulSetProps", + reflect.TypeOf((*KubeStatefulSetProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeStatus", + reflect.TypeOf((*KubeStatus)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeStatus{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeStatusProps", + reflect.TypeOf((*KubeStatusProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeStorageClass", + reflect.TypeOf((*KubeStorageClass)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeStorageClass{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeStorageClassList", + reflect.TypeOf((*KubeStorageClassList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeStorageClassList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeStorageClassListProps", + reflect.TypeOf((*KubeStorageClassListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeStorageClassProps", + reflect.TypeOf((*KubeStorageClassProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeStorageVersionListV1Alpha1", + reflect.TypeOf((*KubeStorageVersionListV1Alpha1)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeStorageVersionListV1Alpha1{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeStorageVersionListV1Alpha1Props", + reflect.TypeOf((*KubeStorageVersionListV1Alpha1Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeStorageVersionV1Alpha1", + reflect.TypeOf((*KubeStorageVersionV1Alpha1)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeStorageVersionV1Alpha1{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeStorageVersionV1Alpha1Props", + reflect.TypeOf((*KubeStorageVersionV1Alpha1Props)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeSubjectAccessReview", + reflect.TypeOf((*KubeSubjectAccessReview)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeSubjectAccessReview{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeSubjectAccessReviewProps", + reflect.TypeOf((*KubeSubjectAccessReviewProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeTokenRequest", + reflect.TypeOf((*KubeTokenRequest)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeTokenRequest{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeTokenRequestProps", + reflect.TypeOf((*KubeTokenRequestProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeTokenReview", + reflect.TypeOf((*KubeTokenReview)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeTokenReview{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeTokenReviewProps", + reflect.TypeOf((*KubeTokenReviewProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeValidatingWebhookConfiguration", + reflect.TypeOf((*KubeValidatingWebhookConfiguration)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeValidatingWebhookConfiguration{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeValidatingWebhookConfigurationList", + reflect.TypeOf((*KubeValidatingWebhookConfigurationList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeValidatingWebhookConfigurationList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeValidatingWebhookConfigurationListProps", + reflect.TypeOf((*KubeValidatingWebhookConfigurationListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeValidatingWebhookConfigurationProps", + reflect.TypeOf((*KubeValidatingWebhookConfigurationProps)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.KubeVolumeAttachment", + reflect.TypeOf((*KubeVolumeAttachment)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeVolumeAttachment{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterClass( + "k8s.KubeVolumeAttachmentList", + reflect.TypeOf((*KubeVolumeAttachmentList)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "addDependency", GoMethod: "AddDependency"}, + _jsii_.MemberMethod{JsiiMethod: "addJsonPatch", GoMethod: "AddJsonPatch"}, + _jsii_.MemberProperty{JsiiProperty: "apiGroup", GoGetter: "ApiGroup"}, + _jsii_.MemberProperty{JsiiProperty: "apiVersion", GoGetter: "ApiVersion"}, + _jsii_.MemberProperty{JsiiProperty: "chart", GoGetter: "Chart"}, + _jsii_.MemberProperty{JsiiProperty: "kind", GoGetter: "Kind"}, + _jsii_.MemberProperty{JsiiProperty: "metadata", GoGetter: "Metadata"}, + _jsii_.MemberProperty{JsiiProperty: "name", GoGetter: "Name"}, + _jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"}, + _jsii_.MemberMethod{JsiiMethod: "toJson", GoMethod: "ToJson"}, + _jsii_.MemberMethod{JsiiMethod: "toString", GoMethod: "ToString"}, + }, + func() interface{} { + j := jsiiProxy_KubeVolumeAttachmentList{} + _jsii_.InitJsiiProxy(&j.Type__cdk8sApiObject) + return &j + }, + ) + _jsii_.RegisterStruct( + "k8s.KubeVolumeAttachmentListProps", + reflect.TypeOf((*KubeVolumeAttachmentListProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.KubeVolumeAttachmentProps", + reflect.TypeOf((*KubeVolumeAttachmentProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LabelSelector", + reflect.TypeOf((*LabelSelector)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LabelSelectorRequirement", + reflect.TypeOf((*LabelSelectorRequirement)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LeaseSpec", + reflect.TypeOf((*LeaseSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Lifecycle", + reflect.TypeOf((*Lifecycle)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LifecycleHandler", + reflect.TypeOf((*LifecycleHandler)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LimitRangeItem", + reflect.TypeOf((*LimitRangeItem)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LimitRangeSpec", + reflect.TypeOf((*LimitRangeSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LimitResponseV1Beta1", + reflect.TypeOf((*LimitResponseV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LimitResponseV1Beta2", + reflect.TypeOf((*LimitResponseV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LimitedPriorityLevelConfigurationV1Beta1", + reflect.TypeOf((*LimitedPriorityLevelConfigurationV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LimitedPriorityLevelConfigurationV1Beta2", + reflect.TypeOf((*LimitedPriorityLevelConfigurationV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ListMeta", + reflect.TypeOf((*ListMeta)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LocalObjectReference", + reflect.TypeOf((*LocalObjectReference)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.LocalVolumeSource", + reflect.TypeOf((*LocalVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ManagedFieldsEntry", + reflect.TypeOf((*ManagedFieldsEntry)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.MetricIdentifierV2", + reflect.TypeOf((*MetricIdentifierV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.MetricIdentifierV2Beta2", + reflect.TypeOf((*MetricIdentifierV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.MetricSpecV2", + reflect.TypeOf((*MetricSpecV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.MetricSpecV2Beta2", + reflect.TypeOf((*MetricSpecV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.MetricTargetV2", + reflect.TypeOf((*MetricTargetV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.MetricTargetV2Beta2", + reflect.TypeOf((*MetricTargetV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.MutatingWebhook", + reflect.TypeOf((*MutatingWebhook)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NamespaceSpec", + reflect.TypeOf((*NamespaceSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NetworkPolicyEgressRule", + reflect.TypeOf((*NetworkPolicyEgressRule)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NetworkPolicyIngressRule", + reflect.TypeOf((*NetworkPolicyIngressRule)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NetworkPolicyPeer", + reflect.TypeOf((*NetworkPolicyPeer)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NetworkPolicyPort", + reflect.TypeOf((*NetworkPolicyPort)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NetworkPolicySpec", + reflect.TypeOf((*NetworkPolicySpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NfsVolumeSource", + reflect.TypeOf((*NfsVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NodeAffinity", + reflect.TypeOf((*NodeAffinity)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NodeConfigSource", + reflect.TypeOf((*NodeConfigSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NodeSelector", + reflect.TypeOf((*NodeSelector)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NodeSelectorRequirement", + reflect.TypeOf((*NodeSelectorRequirement)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NodeSelectorTerm", + reflect.TypeOf((*NodeSelectorTerm)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NodeSpec", + reflect.TypeOf((*NodeSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NonResourceAttributes", + reflect.TypeOf((*NonResourceAttributes)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NonResourcePolicyRuleV1Beta1", + reflect.TypeOf((*NonResourcePolicyRuleV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.NonResourcePolicyRuleV1Beta2", + reflect.TypeOf((*NonResourcePolicyRuleV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ObjectFieldSelector", + reflect.TypeOf((*ObjectFieldSelector)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ObjectMeta", + reflect.TypeOf((*ObjectMeta)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ObjectMetricSourceV2", + reflect.TypeOf((*ObjectMetricSourceV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ObjectMetricSourceV2Beta2", + reflect.TypeOf((*ObjectMetricSourceV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ObjectReference", + reflect.TypeOf((*ObjectReference)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Overhead", + reflect.TypeOf((*Overhead)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.OwnerReference", + reflect.TypeOf((*OwnerReference)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PersistentVolumeClaimSpec", + reflect.TypeOf((*PersistentVolumeClaimSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PersistentVolumeClaimTemplate", + reflect.TypeOf((*PersistentVolumeClaimTemplate)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PersistentVolumeClaimVolumeSource", + reflect.TypeOf((*PersistentVolumeClaimVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PersistentVolumeSpec", + reflect.TypeOf((*PersistentVolumeSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PhotonPersistentDiskVolumeSource", + reflect.TypeOf((*PhotonPersistentDiskVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodAffinity", + reflect.TypeOf((*PodAffinity)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodAffinityTerm", + reflect.TypeOf((*PodAffinityTerm)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodAntiAffinity", + reflect.TypeOf((*PodAntiAffinity)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodDisruptionBudgetSpec", + reflect.TypeOf((*PodDisruptionBudgetSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodDnsConfig", + reflect.TypeOf((*PodDnsConfig)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodDnsConfigOption", + reflect.TypeOf((*PodDnsConfigOption)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodFailurePolicy", + reflect.TypeOf((*PodFailurePolicy)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodFailurePolicyOnExitCodesRequirement", + reflect.TypeOf((*PodFailurePolicyOnExitCodesRequirement)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodFailurePolicyOnPodConditionsPattern", + reflect.TypeOf((*PodFailurePolicyOnPodConditionsPattern)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodFailurePolicyRule", + reflect.TypeOf((*PodFailurePolicyRule)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodOs", + reflect.TypeOf((*PodOs)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodReadinessGate", + reflect.TypeOf((*PodReadinessGate)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodSecurityContext", + reflect.TypeOf((*PodSecurityContext)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodSpec", + reflect.TypeOf((*PodSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodTemplateSpec", + reflect.TypeOf((*PodTemplateSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodsMetricSourceV2", + reflect.TypeOf((*PodsMetricSourceV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PodsMetricSourceV2Beta2", + reflect.TypeOf((*PodsMetricSourceV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PolicyRule", + reflect.TypeOf((*PolicyRule)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PolicyRulesWithSubjectsV1Beta1", + reflect.TypeOf((*PolicyRulesWithSubjectsV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PolicyRulesWithSubjectsV1Beta2", + reflect.TypeOf((*PolicyRulesWithSubjectsV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PortworxVolumeSource", + reflect.TypeOf((*PortworxVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Preconditions", + reflect.TypeOf((*Preconditions)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PreferredSchedulingTerm", + reflect.TypeOf((*PreferredSchedulingTerm)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PriorityLevelConfigurationReferenceV1Beta1", + reflect.TypeOf((*PriorityLevelConfigurationReferenceV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PriorityLevelConfigurationReferenceV1Beta2", + reflect.TypeOf((*PriorityLevelConfigurationReferenceV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PriorityLevelConfigurationSpecV1Beta1", + reflect.TypeOf((*PriorityLevelConfigurationSpecV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.PriorityLevelConfigurationSpecV1Beta2", + reflect.TypeOf((*PriorityLevelConfigurationSpecV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Probe", + reflect.TypeOf((*Probe)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ProjectedVolumeSource", + reflect.TypeOf((*ProjectedVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterClass( + "k8s.Quantity", + reflect.TypeOf((*Quantity)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberProperty{JsiiProperty: "value", GoGetter: "Value"}, + }, + func() interface{} { + return &jsiiProxy_Quantity{} + }, + ) + _jsii_.RegisterStruct( + "k8s.QueuingConfigurationV1Beta1", + reflect.TypeOf((*QueuingConfigurationV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.QueuingConfigurationV1Beta2", + reflect.TypeOf((*QueuingConfigurationV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.QuobyteVolumeSource", + reflect.TypeOf((*QuobyteVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.RbdPersistentVolumeSource", + reflect.TypeOf((*RbdPersistentVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.RbdVolumeSource", + reflect.TypeOf((*RbdVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ReplicaSetSpec", + reflect.TypeOf((*ReplicaSetSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ReplicationControllerSpec", + reflect.TypeOf((*ReplicationControllerSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ResourceAttributes", + reflect.TypeOf((*ResourceAttributes)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ResourceFieldSelector", + reflect.TypeOf((*ResourceFieldSelector)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ResourceMetricSourceV2", + reflect.TypeOf((*ResourceMetricSourceV2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ResourceMetricSourceV2Beta2", + reflect.TypeOf((*ResourceMetricSourceV2Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ResourcePolicyRuleV1Beta1", + reflect.TypeOf((*ResourcePolicyRuleV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ResourcePolicyRuleV1Beta2", + reflect.TypeOf((*ResourcePolicyRuleV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ResourceQuotaSpec", + reflect.TypeOf((*ResourceQuotaSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ResourceRequirements", + reflect.TypeOf((*ResourceRequirements)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.RoleRef", + reflect.TypeOf((*RoleRef)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.RollingUpdateDaemonSet", + reflect.TypeOf((*RollingUpdateDaemonSet)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.RollingUpdateDeployment", + reflect.TypeOf((*RollingUpdateDeployment)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.RollingUpdateStatefulSetStrategy", + reflect.TypeOf((*RollingUpdateStatefulSetStrategy)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.RuleWithOperations", + reflect.TypeOf((*RuleWithOperations)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ScaleIoPersistentVolumeSource", + reflect.TypeOf((*ScaleIoPersistentVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ScaleIoVolumeSource", + reflect.TypeOf((*ScaleIoVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ScaleSpec", + reflect.TypeOf((*ScaleSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Scheduling", + reflect.TypeOf((*Scheduling)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ScopeSelector", + reflect.TypeOf((*ScopeSelector)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ScopedResourceSelectorRequirement", + reflect.TypeOf((*ScopedResourceSelectorRequirement)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SeLinuxOptions", + reflect.TypeOf((*SeLinuxOptions)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SeccompProfile", + reflect.TypeOf((*SeccompProfile)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SecretEnvSource", + reflect.TypeOf((*SecretEnvSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SecretKeySelector", + reflect.TypeOf((*SecretKeySelector)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SecretProjection", + reflect.TypeOf((*SecretProjection)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SecretReference", + reflect.TypeOf((*SecretReference)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SecretVolumeSource", + reflect.TypeOf((*SecretVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SecurityContext", + reflect.TypeOf((*SecurityContext)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SelfSubjectAccessReviewSpec", + reflect.TypeOf((*SelfSubjectAccessReviewSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SelfSubjectRulesReviewSpec", + reflect.TypeOf((*SelfSubjectRulesReviewSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ServiceAccountSubjectV1Beta1", + reflect.TypeOf((*ServiceAccountSubjectV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ServiceAccountSubjectV1Beta2", + reflect.TypeOf((*ServiceAccountSubjectV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ServiceAccountTokenProjection", + reflect.TypeOf((*ServiceAccountTokenProjection)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ServiceBackendPort", + reflect.TypeOf((*ServiceBackendPort)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ServicePort", + reflect.TypeOf((*ServicePort)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ServiceReference", + reflect.TypeOf((*ServiceReference)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ServiceSpec", + reflect.TypeOf((*ServiceSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SessionAffinityConfig", + reflect.TypeOf((*SessionAffinityConfig)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.StatefulSetPersistentVolumeClaimRetentionPolicy", + reflect.TypeOf((*StatefulSetPersistentVolumeClaimRetentionPolicy)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.StatefulSetSpec", + reflect.TypeOf((*StatefulSetSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.StatefulSetUpdateStrategy", + reflect.TypeOf((*StatefulSetUpdateStrategy)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.StatusCause", + reflect.TypeOf((*StatusCause)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.StatusDetails", + reflect.TypeOf((*StatusDetails)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.StorageOsPersistentVolumeSource", + reflect.TypeOf((*StorageOsPersistentVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.StorageOsVolumeSource", + reflect.TypeOf((*StorageOsVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Subject", + reflect.TypeOf((*Subject)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SubjectAccessReviewSpec", + reflect.TypeOf((*SubjectAccessReviewSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SubjectV1Beta1", + reflect.TypeOf((*SubjectV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.SubjectV1Beta2", + reflect.TypeOf((*SubjectV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Sysctl", + reflect.TypeOf((*Sysctl)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Taint", + reflect.TypeOf((*Taint)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.TcpSocketAction", + reflect.TypeOf((*TcpSocketAction)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.TokenRequest", + reflect.TypeOf((*TokenRequest)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.TokenRequestSpec", + reflect.TypeOf((*TokenRequestSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.TokenReviewSpec", + reflect.TypeOf((*TokenReviewSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Toleration", + reflect.TypeOf((*Toleration)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.TopologySelectorLabelRequirement", + reflect.TypeOf((*TopologySelectorLabelRequirement)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.TopologySelectorTerm", + reflect.TypeOf((*TopologySelectorTerm)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.TopologySpreadConstraint", + reflect.TypeOf((*TopologySpreadConstraint)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.TypedLocalObjectReference", + reflect.TypeOf((*TypedLocalObjectReference)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.UserSubjectV1Beta1", + reflect.TypeOf((*UserSubjectV1Beta1)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.UserSubjectV1Beta2", + reflect.TypeOf((*UserSubjectV1Beta2)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ValidatingWebhook", + reflect.TypeOf((*ValidatingWebhook)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.ValidationRule", + reflect.TypeOf((*ValidationRule)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.Volume", + reflect.TypeOf((*Volume)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.VolumeAttachmentSource", + reflect.TypeOf((*VolumeAttachmentSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.VolumeAttachmentSpec", + reflect.TypeOf((*VolumeAttachmentSpec)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.VolumeDevice", + reflect.TypeOf((*VolumeDevice)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.VolumeMount", + reflect.TypeOf((*VolumeMount)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.VolumeNodeAffinity", + reflect.TypeOf((*VolumeNodeAffinity)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.VolumeNodeResources", + reflect.TypeOf((*VolumeNodeResources)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.VolumeProjection", + reflect.TypeOf((*VolumeProjection)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.VsphereVirtualDiskVolumeSource", + reflect.TypeOf((*VsphereVirtualDiskVolumeSource)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.WebhookClientConfig", + reflect.TypeOf((*WebhookClientConfig)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.WebhookConversion", + reflect.TypeOf((*WebhookConversion)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.WeightedPodAffinityTerm", + reflect.TypeOf((*WeightedPodAffinityTerm)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "k8s.WindowsSecurityContextOptions", + reflect.TypeOf((*WindowsSecurityContextOptions)(nil)).Elem(), + ) +} diff --git a/examples/cdk8s-sample-deployment/imports/k8s/version b/examples/cdk8s-sample-deployment/imports/k8s/version new file mode 100644 index 0000000..77d6f4c --- /dev/null +++ b/examples/cdk8s-sample-deployment/imports/k8s/version @@ -0,0 +1 @@ +0.0.0 diff --git a/examples/cdk8s-sample-deployment/main.go b/examples/cdk8s-sample-deployment/main.go new file mode 100644 index 0000000..3df4885 --- /dev/null +++ b/examples/cdk8s-sample-deployment/main.go @@ -0,0 +1,52 @@ +package main + +import ( + "example.com/cdk8s-test/imports/k8s" + "github.com/aws/constructs-go/constructs/v10" + "github.com/aws/jsii-runtime-go" + "github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2" +) + +func NewChart(scope constructs.Construct, id string, ns string, appLabel string) cdk8s.Chart { + + chart := cdk8s.NewChart(scope, jsii.String(id), &cdk8s.ChartProps{ + Namespace: jsii.String(ns), + }) + + labels := map[string]*string{ + "app": jsii.String(appLabel), + } + + k8s.NewKubeDeployment(chart, jsii.String("deployment"), &k8s.KubeDeploymentProps{ + Spec: &k8s.DeploymentSpec{ + Replicas: jsii.Number(1), + Selector: &k8s.LabelSelector{ + MatchLabels: &labels, + }, + Template: &k8s.PodTemplateSpec{ + Metadata: &k8s.ObjectMeta{ + Labels: &labels, + }, + Spec: &k8s.PodSpec{ + Containers: &[]*k8s.Container{{ + Name: jsii.String("app-container"), + Image: jsii.String("nginx:1.19.10"), + Ports: &[]*k8s.ContainerPort{{ + ContainerPort: jsii.Number(80), + }}, + }}, + }, + }, + }, + }) + + return chart +} + +func main() { + app := cdk8s.NewApp(nil) + + NewChart(app, "getting-started", "default", "my-app") + + app.Synth() +} diff --git a/examples/cdk8sappproxy_sample.yaml b/examples/cdk8sappproxy_sample.yaml index 84a6cdb..5c8ae69 100644 --- a/examples/cdk8sappproxy_sample.yaml +++ b/examples/cdk8sappproxy_sample.yaml @@ -2,14 +2,12 @@ apiVersion: addons.cluster.x-k8s.io/v1alpha1 kind: Cdk8sAppProxy metadata: name: cdk8s-sample-app - namespace: default # Or a namespace where your target CAPI Clusters reside + namespace: default spec: gitRepository: - url: https://github.com/PatrickLaabs/cdk8s-sample-deployment - # reference: main # Optional: specify a branch, tag, or commit - # path: "" # Optional: specify a path within the repository if cdk8s app is not at root - clusterSelector: - matchLabels: - environment: development # Adjust to match labels on your target CAPI Clusters - # releaseNamespace: sample-app-namespace # Optional: namespace where the app resources will be deployed on target clusters - # If not specified, resources are often created in 'default' or as defined by the cdk8s app itself. + url: "https://github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/examples/cdk8s-sample-deployment" + reference: "main" + path: "." + clusterSelector: {} + # matchLabels: + # environment: development diff --git a/go.mod b/go.mod index c7fd502..5641fc5 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/onsi/gomega v1.37.0 github.com/pkg/errors v0.9.1 github.com/spf13/pflag v1.0.6 - github.com/stretchr/testify v1.10.0 k8s.io/api v0.32.3 k8s.io/apimachinery v0.32.3 k8s.io/client-go v0.32.3 @@ -77,7 +76,6 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pjbgf/sha1cd v0.3.2 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.22.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.62.0 // indirect @@ -88,7 +86,6 @@ require ( github.com/spf13/cast v1.7.1 // indirect github.com/spf13/cobra v1.9.1 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect - github.com/stretchr/objx v0.5.2 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect diff --git a/go.sum b/go.sum index c521e53..5a06c60 100644 --- a/go.sum +++ b/go.sum @@ -226,8 +226,6 @@ github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8w github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= diff --git a/hack/verify-container-images.sh b/hack/verify-container-images.sh index 694412d..447168a 100755 --- a/hack/verify-container-images.sh +++ b/hack/verify-container-images.sh @@ -53,11 +53,11 @@ chmod +x ${TOOL_BIN}/trivy rm ${TOOL_BIN}/trivy.tar.gz # Builds all the container images to be scanned and cleans up changes to ./*manager_image_patch.yaml ./*manager_pull_policy.yaml. -make REGISTRY=gcr.io/k8s-staging-cluster-api-helm PULL_POLICY=IfNotPresent TAG=dev docker-build +make REGISTRY=ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller PULL_POLICY=IfNotPresent TAG=dev docker-build make clean-release-git # Scan the images -${TOOL_BIN}/trivy image -q --exit-code 1 --ignore-unfixed --severity MEDIUM,HIGH,CRITICAL gcr.io/k8s-staging-cluster-api-helm/cluster-api-helm-controller-"${GO_ARCH}":dev && R5=$? || R5=$? +${TOOL_BIN}/trivy image -q --exit-code 1 --ignore-unfixed --severity MEDIUM,HIGH,CRITICAL ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller-"${GO_ARCH}":dev && R5=$? || R5=$? echo "" BRed='\033[1;31m' diff --git a/main.go b/main.go index e398de9..f6ea53b 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ import ( "time" addonsv1alpha1 "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/api/v1alpha1" - "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/controllers" + caapccontroller "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/controllers/cdk8sappproxy" "github.com/PatrickLaabs/cluster-api-addon-provider-cdk8s/version" "github.com/spf13/pflag" "k8s.io/apimachinery/pkg/runtime" @@ -44,7 +44,6 @@ import ( "sigs.k8s.io/cluster-api/util/flags" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/cache" - "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/healthz" "sigs.k8s.io/controller-runtime/pkg/webhook" ) @@ -206,12 +205,13 @@ func main() { ctx := ctrl.SetupSignalHandler() - if err = (&controllers.Cdk8sAppProxyReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - Recorder: mgr.GetEventRecorderFor("cdk8sappproxy-controller"), + if err = (&caapccontroller.Reconciler{ + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), + Recorder: mgr.GetEventRecorderFor("cdk8sappproxy-controller"), + // Initialize legacy maps for gradual migration ActiveWatches: make(map[types.NamespacedName]map[string]context.CancelFunc), - }).SetupWithManager(mgr, controller.Options{MaxConcurrentReconciles: cdk8sAppProxyConcurrency}); err != nil { + }).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "Cdk8sAppProxy") os.Exit(1) } diff --git a/out/addon-components.yaml b/out/addon-components.yaml deleted file mode 100644 index 965b60c..0000000 --- a/out/addon-components.yaml +++ /dev/null @@ -1,651 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - control-plane: controller-manager - name: caapc-system ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - labels: - cluster.x-k8s.io/provider: cdk8s - name: cdk8sappproxies.addons.cluster.x-k8s.io -spec: - group: addons.cluster.x-k8s.io - names: - kind: Cdk8sAppProxy - listKind: Cdk8sAppProxyList - plural: cdk8sappproxies - shortNames: - - cap - singular: cdk8sappproxy - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .status.conditions[?(@.type=='Ready')].status - name: Ready - type: string - - jsonPath: .status.conditions[?(@.type=='Ready')].reason - name: Reason - type: string - - jsonPath: .status.conditions[?(@.type=='Ready')].message - name: Message - priority: 1 - type: string - name: v1alpha1 - schema: - openAPIV3Schema: - description: Cdk8sAppProxy is the Schema for the cdk8sappproxies 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: Cdk8sAppProxySpec defines the desired state of Cdk8sAppProxy. - properties: - clusterSelector: - description: ClusterSelector selects the clusters to deploy the cdk8s - app to. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. - The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the selector applies - to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - gitRepository: - description: |- - GitRepository specifies the Git repository for the cdk8s app. - One of LocalPath or GitRepository must be specified. - properties: - authSecretRef: - description: |- - AuthSecretRef is a reference to a Secret in the same namespace - containing authentication credentials for the Git repository. - The secret must contain 'username' and 'password' fields. - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - path: - description: |- - Path is the path within the repository where the cdk8s application is located. - Defaults to the root of the repository. - type: string - reference: - description: Reference is the git reference (branch, tag, or commit). - type: string - url: - description: URL is the git repository URL. - type: string - required: - - url - type: object - localPath: - description: |- - LocalPath is the local filesystem path to the cdk8s app. - One of LocalPath or GitRepository must be specified. - type: string - values: - description: Values is a string containing the values to be passed - to the cdk8s app - type: string - required: - - clusterSelector - type: object - status: - description: Cdk8sAppProxyStatus defines the observed state of Cdk8sAppProxy. - properties: - conditions: - description: Conditions defines the current state of the Cdk8sAppProxy. - items: - description: Condition defines an observation of a Cluster API resource - operational state. - properties: - lastTransitionTime: - description: |- - Last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when - the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - A human readable message indicating details about the transition. - This field may be empty. - type: string - reason: - description: |- - The reason for the condition's last transition in CamelCase. - The specific API may choose whether or not this field is considered a guaranteed API. - This field may be empty. - type: string - severity: - description: |- - severity provides an explicit classification of Reason code, so the users or machines can immediately - understand the current situation and act accordingly. - The Severity field MUST be set only when Status=False. - type: string - status: - description: status of the condition, one of True, False, Unknown. - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions - can be useful (see .node.status.conditions), the ability to deconflict is important. - type: string - required: - - lastTransitionTime - - status - - type - type: object - type: array - lastProcessedGitHash: - description: LastProcessedGitHash stores the commit hash of the last - successfully reconciled Git state. - type: string - lastRemoteGitHash: - description: LastRemoteGitHash is the last commit hash fetched from - the remote git repository. - type: string - observedGeneration: - description: ObservedGeneration is the last generation observed by - the controller. - format: int64 - type: integer - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-controller-manager - namespace: caapc-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-leader-election-role - namespace: caapc-system -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-manager-role -rules: -- apiGroups: - - "" - resources: - - secrets - verbs: - - get - - list - - watch -- apiGroups: - - addons.cluster.x-k8s.io - resources: - - cdk8sappproxies - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - addons.cluster.x-k8s.io - resources: - - cdk8sappproxies/finalizers - verbs: - - update -- apiGroups: - - addons.cluster.x-k8s.io - resources: - - cdk8sappproxies/status - verbs: - - get - - patch - - update -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create -- apiGroups: - - cluster.x-k8s.io - resources: - - clusters - - clusters/status - verbs: - - get - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-metrics-auth-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-metrics-reader -rules: -- nonResourceURLs: - - /metrics - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-leader-election-rolebinding - namespace: caapc-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: caapc-leader-election-role -subjects: -- kind: ServiceAccount - name: caapc-controller-manager - namespace: caapc-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: caapc-manager-role -subjects: -- kind: ServiceAccount - name: caapc-controller-manager - namespace: caapc-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-metrics-auth-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: caapc-metrics-auth-role -subjects: -- kind: ServiceAccount - name: caapc-controller-manager - namespace: caapc-system ---- -apiVersion: v1 -data: - controller_manager_config.yaml: | - apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 - kind: ControllerManagerConfig - health: - healthProbeBindAddress: :8081 - metrics: - bindAddress: :8443 - webhook: - port: 9443 - leaderElection: - leaderElect: true - resourceName: 5a2dee3e.cluster.x-k8s.io -kind: ConfigMap -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-manager-config - namespace: caapc-system ---- -apiVersion: v1 -kind: Service -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - control-plane: controller-manager - name: caapc-controller-manager-metrics-service - namespace: caapc-system -spec: - ports: - - name: https - port: 8443 - protocol: TCP - targetPort: 8443 - selector: - cluster.x-k8s.io/provider: cdk8s - control-plane: controller-manager ---- -apiVersion: v1 -kind: Service -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-webhook-service - namespace: caapc-system -spec: - ports: - - port: 443 - protocol: TCP - targetPort: 9443 - selector: - cluster.x-k8s.io/provider: cdk8s - control-plane: controller-manager ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - control-plane: controller-manager - name: caapc-controller-manager - namespace: caapc-system -spec: - replicas: 1 - selector: - matchLabels: - cluster.x-k8s.io/provider: cdk8s - control-plane: controller-manager - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: manager - labels: - cluster.x-k8s.io/provider: cdk8s - control-plane: controller-manager - spec: - containers: - - args: - - --leader-elect - - --diagnostics-address=:8443 - - --insecure-diagnostics=false - - --sync-period=10m - - --v=2 - env: - - name: XDG_DATA_HOME - value: /tmp/xdg/.data - - name: XDG_CONFIG_HOME - value: /tmp/xdg/.config - - name: XDG_STATE_HOME - value: /tmp/xdg/.state - - name: XDG_CACHE_HOME - value: /tmp/xdg/.cache - - name: XDG_CONFIG_DIRS - value: /tmp/xdg - - name: KUBECACHEDIR - value: /tmp/.kube/cache - image: ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s/cluster-api-cdk8s-controller:v0.2.4-alpha - imagePullPolicy: IfNotPresent - livenessProbe: - httpGet: - path: /healthz - port: healthz - initialDelaySeconds: 10 - periodSeconds: 10 - name: manager - ports: - - containerPort: 9443 - name: webhook-server - protocol: TCP - - containerPort: 9440 - name: healthz - protocol: TCP - - containerPort: 8443 - name: metrics - protocol: TCP - readinessProbe: - httpGet: - path: /readyz - port: healthz - initialDelaySeconds: 10 - periodSeconds: 10 - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - privileged: false - readOnlyRootFilesystem: false - runAsGroup: 65532 - runAsUser: 65532 - volumeMounts: - - mountPath: /tmp/k8s-webhook-server/serving-certs - name: cert - readOnly: true - - mountPath: /tmp - name: tmp - securityContext: - runAsNonRoot: true - seccompProfile: - type: RuntimeDefault - serviceAccountName: caapc-controller-manager - terminationGracePeriodSeconds: 10 - volumes: - - name: cert - secret: - defaultMode: 420 - secretName: webhook-server-cert - - emptyDir: {} - name: tmp ---- -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-serving-cert - namespace: caapc-system -spec: - dnsNames: - - caapc-webhook-service.caapc-system.svc - - caapc-webhook-service.caapc-system.svc.cluster.local - issuerRef: - kind: Issuer - name: caapc-selfsigned-issuer - secretName: webhook-server-cert ---- -apiVersion: cert-manager.io/v1 -kind: Issuer -metadata: - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-selfsigned-issuer - namespace: caapc-system -spec: - selfSigned: {} ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: MutatingWebhookConfiguration -metadata: - annotations: - cert-manager.io/inject-ca-from: caapc-system/caapc-serving-cert - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-mutating-webhook-configuration -webhooks: -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: caapc-webhook-service - namespace: caapc-system - path: /mutate-addons-cluster-x-k8s-io-v1alpha1-cdk8sappproxy - failurePolicy: Fail - name: cdk8sappproxy.kb.io - rules: - - apiGroups: - - addons.cluster.x-k8s.io - apiVersions: - - v1alpha1 - operations: - - CREATE - - UPDATE - resources: - - cdk8sappproxies - sideEffects: None ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - annotations: - cert-manager.io/inject-ca-from: caapc-system/caapc-serving-cert - labels: - cluster.x-k8s.io/provider: cdk8s - name: caapc-validating-webhook-configuration -webhooks: -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: caapc-webhook-service - namespace: caapc-system - path: /validate-addons-cluster-x-k8s-io-v1alpha1-cdk8sappproxy - failurePolicy: Fail - name: cdk8sappproxy.kb.io - rules: - - apiGroups: - - addons.cluster.x-k8s.io - apiVersions: - - v1alpha1 - operations: - - CREATE - - UPDATE - resources: - - cdk8sappproxies - sideEffects: None diff --git a/out/metadata.yaml b/out/metadata.yaml deleted file mode 100644 index cab8f7e..0000000 --- a/out/metadata.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# maps release series of major.minor to cluster-api contract version -# the contract version may change between minor or major versions, but *not* -# between patch versions. -# -# update this file only when a new major or minor version is released -apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 -kind: Metadata -releaseSeries: - - major: 0 - minor: 1 - contract: v1beta1 - - major: 0 - minor: 2 - contract: v1beta1 - - major: 0 - minor: 3 - contract: v1beta1 diff --git a/scripts/ci-e2e-lib.sh b/scripts/ci-e2e-lib.sh index 2feaf65..d64519f 100644 --- a/scripts/ci-e2e-lib.sh +++ b/scripts/ci-e2e-lib.sh @@ -22,7 +22,7 @@ capi:buildDockerImages () { # please ensure the generated image name matches image names used in the E2E_CONF_FILE; # also the same settings must be set in Makefile, docker-build-e2e target. ARCH="$(go env GOARCH)" - export REGISTRY=gcr.io/k8s-staging-cluster-api-helm + export REGISTRY=ghcr.io/patricklaabs/cluster-api-addon-provider-cdk8s export TAG=dev export ARCH diff --git a/version/version.go b/version/version.go index cce843e..4464ef4 100644 --- a/version/version.go +++ b/version/version.go @@ -26,7 +26,7 @@ var ( gitMinor string // minor version, numeric possibly followed by "+" gitVersion string // semantic version, derived by build scripts gitCommit string // sha1 from git, output of $(git rev-parse HEAD) - gitTreeState string // state of git tree, either "clean" or "dirty" + gitTreeState string // state of the git tree, either "clean" or "dirty" buildDate string // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ') ) @@ -43,7 +43,7 @@ type Info struct { Platform string `json:"platform,omitempty"` } -// Get returns version info initialized from defaults and the runtime environment. +// Get return version info initialized from defaults and the runtime environment. func Get() Info { return Info{ Major: gitMajor,