Skip to content
Open
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
70 changes: 59 additions & 11 deletions client/api/omni/specs/siderolink.pb.go

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

5 changes: 5 additions & 0 deletions client/api/omni/specs/siderolink.proto
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,8 @@ message JoinTokenUsageSpec {
message DefaultJoinTokenSpec {
string token_id = 1;
}

// GRPCTunnelConfig is the user managed resource that allows configuring gRPC tunnel per machine.
message GRPCTunnelConfigSpec {
bool enabled = 1;
}
163 changes: 163 additions & 0 deletions client/api/omni/specs/siderolink_vtproto.pb.go

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

1 change: 1 addition & 0 deletions client/pkg/omni/resources/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var UserManagedResourceTypes = []resource.Type{
authres.SAMLLabelRuleType,
siderolink.JoinTokenType,
siderolink.DefaultJoinTokenType,
siderolink.GRPCTunnelConfigType,
omni.ClusterType,
omni.ConfigPatchType,
omni.EtcdManualBackupType,
Expand Down
47 changes: 47 additions & 0 deletions client/pkg/omni/resources/siderolink/grpc_tunnel_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

package siderolink

import (
"github.com/cosi-project/runtime/pkg/resource"
"github.com/cosi-project/runtime/pkg/resource/meta"
"github.com/cosi-project/runtime/pkg/resource/protobuf"
"github.com/cosi-project/runtime/pkg/resource/typed"

"github.com/siderolabs/omni/client/api/omni/specs"
"github.com/siderolabs/omni/client/pkg/omni/resources"
)

// NewGRPCTunnelConfig creates new GRPCTunnelConfig state.
func NewGRPCTunnelConfig(id string) *GRPCTunnelConfig {
return typed.NewResource[GRPCTunnelConfigSpec, GRPCTunnelConfigExtension](
resource.NewMetadata(resources.DefaultNamespace, GRPCTunnelConfigType, id, resource.VersionUndefined),
protobuf.NewResourceSpec(&specs.GRPCTunnelConfigSpec{}),
)
}

// GRPCTunnelConfigType is the type of GRPCTunnelConfig resource.
//
// tsgen:GRPCTunnelConfigType
const GRPCTunnelConfigType = resource.Type("GRPCTunnelConfigs.omni.sidero.dev")

// GRPCTunnelConfig resource is the per machine gRPC tunnel mode config.
type GRPCTunnelConfig = typed.Resource[GRPCTunnelConfigSpec, GRPCTunnelConfigExtension]

// GRPCTunnelConfigSpec wraps specs.GRPCTunnelConfigSpec.
type GRPCTunnelConfigSpec = protobuf.ResourceSpec[specs.GRPCTunnelConfigSpec, *specs.GRPCTunnelConfigSpec]

// GRPCTunnelConfigExtension providers auxiliary methods for GRPCTunnelConfig resource.
type GRPCTunnelConfigExtension struct{}

// ResourceDefinition implements [typed.Extension] interface.
func (GRPCTunnelConfigExtension) ResourceDefinition() meta.ResourceDefinitionSpec {
return meta.ResourceDefinitionSpec{
Type: GRPCTunnelConfigType,
Aliases: []resource.Type{},
DefaultNamespace: resources.DefaultNamespace,
PrintColumns: nil,
}
}
1 change: 1 addition & 0 deletions client/pkg/omni/resources/siderolink/siderolink.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func init() {
registry.MustRegisterResource(DefaultJoinTokenType, &DefaultJoinToken{})
registry.MustRegisterResource(NodeUniqueTokenType, &NodeUniqueToken{})
registry.MustRegisterResource(NodeUniqueTokenStatusType, &NodeUniqueTokenStatus{})
registry.MustRegisterResource(GRPCTunnelConfigType, &GRPCTunnelConfig{})

// NOTE: this resource is not used anymore, but still used in the migration code.
registry.MustRegisterResource(DeprecatedLinkCounterType, &DeprecatedLinkCounter{})
Expand Down
Loading
Loading