Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rollouts: added cluster discovery types #3753

Merged
merged 1 commit into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions internal/testutil/pkgbuilder/builder_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 Google LLC
//
// 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 pkgbuilder

import (
Expand Down
18 changes: 17 additions & 1 deletion rollouts/api/v1alpha1/rollout_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// RolloutSpec defines the desired state of Rollout
type RolloutSpec struct {
// Description is a user friendly description of this Rollout.
Description string `json:"description,omitempty"`

// Clusters specifies the source for discovering the clusters.
Clusters ClusterDiscovery `json:"clusters"`

// Packages source for this Rollout.
Packages PackagesConfig `json:"packages"`

Expand All @@ -51,6 +53,20 @@ type ClusterRef struct {
Name string `json:"name"`
}

// different types of cluster sources
const (
KCC ClusterSourceType = "KCC"
GCPFleet ClusterSourceType = "GCPFleet"
)

// +kubebuilder:validation:Enum=KCC;GCPFleet
type ClusterSourceType string

// ClusterDiscovery represents configuration needed to discover clusters.
type ClusterDiscovery struct {
SourceType ClusterSourceType `json:"sourceType"`
}

const (
GitHub PackageSourceType = "GitHub"
)
Expand Down
16 changes: 16 additions & 0 deletions rollouts/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions rollouts/config/crd/bases/gitops.kpt.dev_rollouts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ spec:
spec:
description: RolloutSpec defines the desired state of Rollout
properties:
clusters:
description: Clusters specifies the source for discovering the clusters.
properties:
sourceType:
enum:
- KCC
- GCPFleet
type: string
required:
- sourceType
type: object
description:
description: Description is a user friendly description of this Rollout.
type: string
Expand Down Expand Up @@ -211,6 +222,7 @@ spec:
x-kubernetes-map-type: atomic
type: object
required:
- clusters
- packageToTargetMatcher
- packages
- strategy
Expand Down
2 changes: 2 additions & 0 deletions rollouts/config/samples/gitops_rollout_cert_manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ metadata:
name: cert-manager-rollout
spec:
description: kpt samples rollout
clusters:
sourceType: KCC
packages:
sourceType: GitHub
github:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ metadata:
name: cm-progressive
spec:
description: kpt samples rollout
clusters:
sourceType: KCC
packages:
sourceType: GitHub
github:
Expand Down
2 changes: 2 additions & 0 deletions rollouts/config/samples/gitops_rollout_kpt_samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ metadata:
name: rollout-kpt-samples
spec:
description: kpt samples rollout
clusters:
sourceType: KCC
packages:
sourceType: GitHub
github:
Expand Down
2 changes: 2 additions & 0 deletions rollouts/config/samples/gitops_rollout_oahu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ metadata:
name: rollout-oahu
spec:
description: oahu rollout
clusters:
sourceType: KCC
packages:
sourceType: GitHub
github:
Expand Down
2 changes: 2 additions & 0 deletions rollouts/config/samples/gitops_rollout_repo_selector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ metadata:
name: rollout-repo-selector
spec:
description: repo selector rollout
clusters:
sourceType: KCC
packages:
sourceType: GitHub
github:
Expand Down
14 changes: 14 additions & 0 deletions tools/licensescan/licensedb_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
Expand Down