Skip to content

Commit

Permalink
Merge pull request #2403 from yuwenma/proto-specify-versoin
Browse files Browse the repository at this point in the history
Smooth promo for cbwp
  • Loading branch information
google-oss-prow[bot] authored Aug 2, 2024
2 parents 1782c2e + cb2634d commit ff23c7c
Show file tree
Hide file tree
Showing 8 changed files with 622 additions and 6 deletions.
44 changes: 44 additions & 0 deletions apis/cloudbuild/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Copyright 2024.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the cloudbuild v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=cloudbuild.cnrm.cloud.google.com
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "cloudbuild.cnrm.cloud.google.com", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme

CloudBuildWorkerPoolKind = "CloudBuildWorkerPool"

GroupVersionKind = schema.GroupVersionKind{
Group: GroupVersion.Group,
Version: GroupVersion.Version,
Kind: CloudBuildWorkerPoolKind,
}
)
122 changes: 122 additions & 0 deletions apis/cloudbuild/v1alpha1/workerpool_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
Copyright 2024.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
refv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/k8s/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// CloudBuildWorkerPoolSpec defines the desired state of Instance
type CloudBuildWorkerPoolSpec struct {
Name string `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
ResourceID *string `json:"resourceID,omitempty"`
// +required
ProjectRef *refv1beta1.ProjectRef `json:"projectRef"`
// +required
Location string `json:"location"`
// +required
PrivatePoolConfig *PrivatePoolV1Config `json:"privatePoolV1Config,omitempty"`
}

type PrivatePoolV1Config struct {
// +required
WorkerConfig *WorkerConfig `json:"workerConfig,omitempty"`
// +optional
NetworkConfig *NetworkConfig `json:"networkConfig,omitempty"`
}

type WorkerConfig struct {
// +optional
MachineType string `json:"machineType,omitempty"`
// +optional
DiskSizeGb int64 `json:"diskSizeGb,omitempty"`
}

type NetworkConfig struct {
// +required
PeeredNetworkRef refv1beta1.ComputeNetworkRef `json:"peeredNetworkRef,omitempty"`
// +optional
EgressOption string `json:"egressOption,omitempty"`
// +optional
PeeredNetworkIPRange string `json:"peeredNetworkIPRange,omitempty"`
}

// CloudBuildWorkerPoolStatus defines the observed state of Instance
type CloudBuildWorkerPoolStatus struct {
/* Conditions represent the latest available observations of the
object's current state. */
Conditions []v1alpha1.Condition `json:"conditions,omitempty"`

/* ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. */
// +optional
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`

/* ObservedState is the state of the resource as most recently observed in GCP. */
// +optional
ObservedState *CloudBuildWorkerPoolObservedState `json:"observedState,omitempty"`
}

type CloudBuildWorkerPoolObservedState struct {
/* The creation timestamp of the workerpool.*/
// +optional
// +kubebuilder:validation:Format=date-time
CreateTime *string `json:"createTime,omitempty"`

/* The last update timestamp of the workerpool.*/
// +optional
// +kubebuilder:validation:Format=date-time
UpdateTime *string `json:"updateTime,omitempty"`
// +optional
WorkerConfig *WorkerConfig `json:"workerConfig,omitempty"`
NetworkConfig *NetworkConfigState `json:"networkConfig,omitempty"`
}

type NetworkConfigState struct {
// +optional
PeeredNetwork string `json:"peeredNetwork,omitempty"`
// +optional
EgressOption string `json:"egressOption,omitempty"`
// +optional
PeeredNetworkIPRange string `json:"peeredNetworkIPRange,omitempty"`
}

// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/stability-level=beta"
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CloudBuildWorkerPool is the Schema for the CloudBuild WorkerPool API
// +kubebuilder:subresource:status
type CloudBuildWorkerPool struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CloudBuildWorkerPoolSpec `json:"spec,omitempty"`
Status CloudBuildWorkerPoolStatus `json:"status,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CloudBuildWorkerPoolList contains a list of WorkerPool
type CloudBuildWorkerPoolList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CloudBuildWorkerPool `json:"items"`
}

func init() {
SchemeBuilder.Register(&CloudBuildWorkerPool{}, &CloudBuildWorkerPoolList{})
}
Loading

0 comments on commit ff23c7c

Please sign in to comment.