Skip to content

Commit

Permalink
Add structs for ResourceGroup objects (#2619)
Browse files Browse the repository at this point in the history
* feat: Add structs for ResourceGroup objects

This commit introduces the required types to move inventory information
out from thee Kptfile and into a separate resourcegroup.yaml resource
file.

Since the ResourceGroup CRD was hard coded previously, and ResourceGroup
objects were always handled as unstructured objects, these type
definitions did not exist prior to this commit.

* refactor: Rename default meta struct for ResourceGroup
  • Loading branch information
rquitales authored Jan 27, 2022
1 parent e077c01 commit a33e987
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions pkg/api/resourcegroup/v1alpha1/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2021 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 defines ResourceGroup schema.
// Version: v1alpha1
// swagger:meta
package v1alpha1

import (
"sigs.k8s.io/kustomize/kyaml/yaml"
)

const (
RGFileName = "resourcegroup.yaml"
RGFileKind = "ResourceGroup"
RGFileGroup = "kpt.dev"
RGFileVersion = "v1alpha1"
RGFileAPIVersion = RGFileGroup + "/" + RGFileVersion
)

// DefaultMeta is the ResourceMeta for ResourceGroup instances.
var DefaultMeta = yaml.ResourceMeta{
TypeMeta: yaml.TypeMeta{
APIVersion: RGFileAPIVersion,
Kind: RGFileKind,
},
}

// ResourceGroup contains the inventory information about a package managed with kpt.
// swagger:model resourcegroup
type ResourceGroup struct {
yaml.ResourceMeta `yaml:",inline" json:",inline"`
}

0 comments on commit a33e987

Please sign in to comment.