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

Sync upstream release 1.16 #148

Merged
merged 8 commits into from
Nov 5, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

env:
# Common versions
GO_VERSION: '1.22.3'
GO_VERSION: '1.22.8'
GOLANGCI_VERSION: 'v1.57.2'
DOCKER_BUILDX_VERSION: 'v0.10.0'

Expand Down
89 changes: 89 additions & 0 deletions apis/pkg/v1beta1/image_config_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
Copyright 2024 The Crossplane 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 v1beta1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// MatchType is the method used to match the image.
type MatchType string

const (
// Prefix is used to match the prefix of the image.
Prefix MatchType = "Prefix"
)

// +kubebuilder:object:root=true
// +genclient
// +genclient:nonNamespaced

// The ImageConfig resource is used to configure settings for package images.
//
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:resource:scope=Cluster,categories={crossplane}
type ImageConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ImageConfigSpec `json:"spec,omitempty"`
}

// +kubebuilder:object:root=true

// ImageConfigList contains a list of ImageConfig.
type ImageConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ImageConfig `json:"items"`
}

// ImageMatch defines a rule for matching image.
type ImageMatch struct {
// Type is the type of match.
// +optional
// +kubebuilder:validation:Enum=Prefix
// +kubebuilder:default=Prefix
Type MatchType `json:"type,omitempty"`
// Prefix is the prefix that should be matched.
Prefix string `json:"prefix"`
}

// RegistryAuthentication contains the authentication information for a registry.
type RegistryAuthentication struct {
// PullSecretRef is a reference to a secret that contains the credentials for
// the registry.
PullSecretRef corev1.LocalObjectReference `json:"pullSecretRef"`
}

// RegistryConfig contains the configuration for the registry.
type RegistryConfig struct {
// Authentication is the authentication information for the registry.
// +optional
Authentication *RegistryAuthentication `json:"authentication,omitempty"`
}

// ImageConfigSpec contains the configuration for matching images.
type ImageConfigSpec struct {
// MatchImages is a list of image matching rules that should be satisfied.
// +kubebuilder:validation:XValidation:rule="size(self) > 0",message="matchImages should have at least one element."
MatchImages []ImageMatch `json:"matchImages"`
// Registry is the configuration for the registry.
// +optional
Registry *RegistryConfig `json:"registry,omitempty"`
}
9 changes: 9 additions & 0 deletions apis/pkg/v1beta1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,18 @@ var (
DeploymentRuntimeConfigGroupVersionKind = SchemeGroupVersion.WithKind(DeploymentRuntimeConfigKind)
)

// ImageConfig type metadata.
var (
ImageConfigKind = reflect.TypeOf(ImageConfig{}).Name()
ImageConfigGroupKind = schema.GroupKind{Group: Group, Kind: ImageConfigKind}.String()
ImageConfigKindAPIVersion = ImageConfigKind + "." + SchemeGroupVersion.String()
ImageConfigGroupVersionKind = SchemeGroupVersion.WithKind(ImageConfigKind)
)

func init() {
SchemeBuilder.Register(&Lock{}, &LockList{})
SchemeBuilder.Register(&Function{}, &FunctionList{})
SchemeBuilder.Register(&FunctionRevision{}, &FunctionRevisionList{})
SchemeBuilder.Register(&DeploymentRuntimeConfig{}, &DeploymentRuntimeConfigList{})
SchemeBuilder.Register(&ImageConfig{}, &ImageConfigList{})
}
134 changes: 134 additions & 0 deletions apis/pkg/v1beta1/zz_generated.deepcopy.go

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

100 changes: 100 additions & 0 deletions cluster/crds/pkg.crossplane.io_imageconfigs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: imageconfigs.pkg.crossplane.io
spec:
group: pkg.crossplane.io
names:
categories:
- crossplane
kind: ImageConfig
listKind: ImageConfigList
plural: imageconfigs
singular: imageconfig
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .metadata.creationTimestamp
name: AGE
type: date
name: v1beta1
schema:
openAPIV3Schema:
description: The ImageConfig resource is used to configure settings for package
images.
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: ImageConfigSpec contains the configuration for matching images.
properties:
matchImages:
description: MatchImages is a list of image matching rules that should
be satisfied.
items:
description: ImageMatch defines a rule for matching image.
properties:
prefix:
description: Prefix is the prefix that should be matched.
type: string
type:
default: Prefix
description: Type is the type of match.
enum:
- Prefix
type: string
required:
- prefix
type: object
type: array
x-kubernetes-validations:
- message: matchImages should have at least one element.
rule: size(self) > 0
registry:
description: Registry is the configuration for the registry.
properties:
authentication:
description: Authentication is the authentication information
for the registry.
properties:
pullSecretRef:
description: |-
PullSecretRef is a reference to a secret that contains the credentials for
the registry.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?
type: string
type: object
x-kubernetes-map-type: atomic
required:
- pullSecretRef
type: object
type: object
required:
- matchImages
type: object
type: object
served: true
storage: true
subresources: {}
1 change: 1 addition & 0 deletions cluster/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ resources:
- crds/pkg.crossplane.io_deploymentruntimeconfigs.yaml
- crds/pkg.crossplane.io_functionrevisions.yaml
- crds/pkg.crossplane.io_functions.yaml
- crds/pkg.crossplane.io_imageconfigs.yaml
- crds/pkg.crossplane.io_locks.yaml
- crds/pkg.crossplane.io_providerrevisions.yaml
- crds/pkg.crossplane.io_providers.yaml
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/crossplane/crossplane

go 1.21
go 1.21.13

toolchain go1.22.3
toolchain go1.22.8

require (
dario.cat/mergo v1.0.0
Expand Down Expand Up @@ -60,7 +60,7 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/cel-go v0.17.7 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
Expand Down
Loading
Loading